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:
parent
4c85971b2e
commit
c3b56d7710
|
@ -432,7 +432,12 @@ function previous_post_link($format='« %link', $link='%title', $in_same_ca
|
||||||
if ( !$post )
|
if ( !$post )
|
||||||
return;
|
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).'">';
|
$string = '<a href="'.get_permalink($post->ID).'">';
|
||||||
$link = str_replace('%title', $title, $link);
|
$link = str_replace('%title', $title, $link);
|
||||||
$link = $pre . $string . $link . '</a>';
|
$link = $pre . $string . $link . '</a>';
|
||||||
|
@ -448,7 +453,12 @@ function next_post_link($format='%link »', $link='%title', $in_same_cat =
|
||||||
if ( !$post )
|
if ( !$post )
|
||||||
return;
|
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).'">';
|
$string = '<a href="'.get_permalink($post->ID).'">';
|
||||||
$link = str_replace('%title', $title, $link);
|
$link = str_replace('%title', $title, $link);
|
||||||
$link = $string . $link . '</a>';
|
$link = $string . $link . '</a>';
|
||||||
|
|
Loading…
Reference in New Issue