Filter the title in next_post() and previous_post(). Mark next_post() and previous_post() as deprecated. Update the default theme to use next_post_link() and previous_post_link(). http://mosquito.wordpress.org/view.php?id=1241 Hat tip: wyrfel

git-svn-id: https://develop.svn.wordpress.org/trunk@2538 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2005-04-17 17:09:19 +00:00
parent f26e7d7e0d
commit f558669a6e
2 changed files with 6 additions and 4 deletions

View File

@ -5,8 +5,8 @@
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<div class="navigation">
<div class="alignleft"><?php previous_post('&laquo; %','','yes') ?></div>
<div class="alignright"><?php next_post(' % &raquo;','','yes') ?></div>
<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
<div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
</div>
<div class="post">

View File

@ -293,6 +293,7 @@ function next_post_link($format='%link &raquo;', $link='%title', $in_same_cat =
echo $format;
}
// Deprecated. Use previous_post_link().
function previous_post($format='%', $previous='previous post: ', $title='yes', $in_same_cat='no', $limitprev=1, $excluded_categories='') {
global $id, $post, $wpdb;
global $posts, $posts_per_page, $s;
@ -321,7 +322,7 @@ function previous_post($format='%', $previous='previous post: ', $title='yes', $
if ($lastpost) {
$string = '<a href="'.get_permalink($lastpost->ID).'">'.$previous;
if ($title == 'yes') {
$string .= wptexturize($lastpost->post_title);
$string .= apply_filters('the_title', $lastpost->post_title, $lastpost);
}
$string .= '</a>';
$format = str_replace('%', $string, $format);
@ -330,6 +331,7 @@ function previous_post($format='%', $previous='previous post: ', $title='yes', $
}
}
// Deprecated. Use next_post_link().
function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat='no', $limitnext=1, $excluded_categories='') {
global $posts_per_page, $post, $wpdb;
if(1 == $posts_per_page || is_single()) {
@ -359,7 +361,7 @@ function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat=
if ($nextpost) {
$string = '<a href="'.get_permalink($nextpost->ID).'">'.$next;
if ($title=='yes') {
$string .= wptexturize($nextpost->post_title);
$string .= apply_filters('the_title', $nextpost->post_title, $nextpost);
}
$string .= '</a>';
$format = str_replace('%', $string, $format);