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: http://svn.automattic.com/wordpress/trunk@2538 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2005-04-17 17:09:19 +00:00
parent c996e21818
commit 9fd4eb9adf
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);