Switch language

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




adjacent_post_link [ WordPress Function ]

adjacent_post_link ( $format, $link, $in_same_cat = false, $excluded_categories = '', $previous = true )
Parameters:
  • (string) $format Link anchor format.
  • (string) $link Link permalink format.
  • (bool) $in_same_cat Optional. Whether link should be in a same category.
  • (array|string) $excluded_categories Optional. Array or comma-separated list of excluded category IDs.
  • (bool) $previous Optional, default is true. Whether to display link to previous or next post.
Defined at:



Display adjacent post link.

Can be either next post link or previous.

Source


<?php
function adjacent_post_link($format$link$in_same_cat false$excluded_categories ''$previous true) {
    if ( 
$previous && is_attachment() )
        
$post = & get_post($GLOBALS['post']->post_parent);
    else
        
$post get_adjacent_post($in_same_cat$excluded_categories$previous);

    if ( !
$post )
        return;

    
$title $post->post_title;

    if ( empty(
$post->post_title) )
        
$title $previous __('Previous Post') : __('Next Post');

    
$title apply_filters('the_title'$title$post->ID);
    
$date mysql2date(get_option('date_format'), $post->post_date);
    
$rel $previous 'prev' 'next';

    
$string '<a href="'.get_permalink($post).'" rel="'.$rel.'">';
    
$link str_replace('%title'$title$link);
    
$link str_replace('%date'$date$link);
    
$link $string $link '</a>';

    
$format str_replace('%link'$link$format);

    
$adjacent $previous 'previous' 'next';
    echo 
apply_filters"{$adjacent}_post_link"$format$link );
}
?>

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