Ensure (next|previous)_post_link always have some content even when the post title is blank. Fixes #1835, props johnbillion
git-svn-id: http://svn.automattic.com/wordpress/trunk@6082 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
e3db8369d0
commit
446c704af5
|
@ -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 »', $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>';
|
||||
|
|
Loading…
Reference in New Issue