Ensure (next|previous)_post_link always have some content even when the post title is blank. Fixes #1835, props johnbillion

git-svn-id: https://develop.svn.wordpress.org/trunk@6082 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Peter Westwood 2007-09-11 20:05:52 +00:00
parent 4c85971b2e
commit c3b56d7710
1 changed files with 12 additions and 2 deletions

View File

@ -432,7 +432,12 @@ function previous_post_link($format='« %link', $link='%title', $in_same_ca
if ( !$post )
return;
$title = apply_filters('the_title', $post->post_title, $post);
$title = $post->post_title;
if ( empty($post->post_title) )
$title = __('Previous Post');
$title = apply_filters('the_title', $title, $post);
$string = '<a href="'.get_permalink($post->ID).'">';
$link = str_replace('%title', $title, $link);
$link = $pre . $string . $link . '</a>';
@ -448,7 +453,12 @@ function next_post_link($format='%link &raquo;', $link='%title', $in_same_cat =
if ( !$post )
return;
$title = apply_filters('the_title', $post->post_title, $post);
$title = $post->post_title;
if ( empty($post->post_title) )
$title = __('Next Post');
$title = apply_filters('the_title', $title, $post);
$string = '<a href="'.get_permalink($post->ID).'">';
$link = str_replace('%title', $title, $link);
$link = $string . $link . '</a>';