mirror of
https://github.com/WordPress/WordPress.git
synced 2025-01-09 18:08:09 +01:00
previous/next_post don't link to non-published posts.
Fix by Alex King git-svn-id: http://svn.automattic.com/wordpress/trunk@268 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3ba4473cac
commit
1556042c08
@ -618,7 +618,7 @@ function previous_post($format='%', $previous='previous post: ', $title='yes', $
|
|||||||
}
|
}
|
||||||
|
|
||||||
$limitprev--;
|
$limitprev--;
|
||||||
$lastpost = @$wpdb->get_row("SELECT ID, post_title FROM $tableposts WHERE post_date < '$current_post_date' AND post_category > 0 $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT $limitprev, 1");
|
$lastpost = @$wpdb->get_row("SELECT ID, post_title FROM $tableposts WHERE post_date < '$current_post_date' AND post_category > 0 AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date DESC LIMIT $limitprev, 1");
|
||||||
++$querycount;
|
++$querycount;
|
||||||
if ($lastpost) {
|
if ($lastpost) {
|
||||||
$string = '<a href="'.$blogfilename.$querystring_start.'p'.$querystring_equal.$lastpost->ID.$querystring_separator.'more'.$querystring_equal.'1'.$querystring_separator.'c'.$querystring_equal.'1">'.$previous;
|
$string = '<a href="'.$blogfilename.$querystring_start.'p'.$querystring_equal.$lastpost->ID.$querystring_separator.'more'.$querystring_equal.'1'.$querystring_separator.'c'.$querystring_equal.'1">'.$previous;
|
||||||
@ -659,7 +659,7 @@ function next_post($format='%', $next='next post: ', $title='yes', $in_same_cat=
|
|||||||
|
|
||||||
$limitnext--;
|
$limitnext--;
|
||||||
|
|
||||||
$nextpost = @$wpdb->get_row("SELECT ID,post_title FROM $tableposts WHERE post_date > '$current_post_date' AND post_date < '$now' AND post_category > 0 $sqlcat $sql_exclude_cats ORDER BY post_date ASC LIMIT $limitnext,1");
|
$nextpost = @$wpdb->get_row("SELECT ID,post_title FROM $tableposts WHERE post_date > '$current_post_date' AND post_date < '$now' AND post_category > 0 AND post_status = 'publish' $sqlcat $sql_exclude_cats ORDER BY post_date ASC LIMIT $limitnext,1");
|
||||||
++$querycount;
|
++$querycount;
|
||||||
if ($nextpost) {
|
if ($nextpost) {
|
||||||
$string = '<a href="'.$blogfilename.$querystring_start.'p'.$querystring_equal.$nextpost->ID.$querystring_separator.'more'.$querystring_equal.'1'.$querystring_separator.'c'.$querystring_equal.'1">'.$next;
|
$string = '<a href="'.$blogfilename.$querystring_start.'p'.$querystring_equal.$nextpost->ID.$querystring_separator.'more'.$querystring_equal.'1'.$querystring_separator.'c'.$querystring_equal.'1">'.$next;
|
||||||
|
Loading…
Reference in New Issue
Block a user