Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




adjacent_image_link [ WordPress Function ]

adjacent_image_link ( $prev = true, $size = 'thumbnail', $text = false )
Parameters:
  • (bool) $prev Optional. Default is true to display previous link, false for next.
Defined at:



Display next or previous image link that has the same post parent.

Retrieves the current attachment object from the $post global.

Source


<?php
function adjacent_image_link($prev true$size 'thumbnail'$text false) {
    global 
$post;
    
$post get_post($post);
    
$attachments array_values(get_children( array('post_parent' => $post->post_parent'post_status' => 'inherit''post_type' => 'attachment''post_mime_type' => 'image''order' => 'ASC''orderby' => 'menu_order ID') ));

    foreach ( 
$attachments as $k => $attachment )
        if ( 
$attachment->ID == $post->ID )
            break;

    
$k $prev $k $k 1;

    if ( isset(
$attachments[$k]) )
        echo 
wp_get_attachment_link($attachments[$k]->ID$sizetruefalse$text);
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

Kullanýcý Tartýþmalarý [ wordpress.org ]

- Bulunamadý -

Yeni bir konu yaz ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics