Changeset 268

Show
Ignore:
Timestamp:
07/23/03 21:04:25 (5 years ago)
Author:
mikelittle
Message:

previous/next_post don't link to non-published posts.
Fix by Alex King

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/b2-include/b2template.functions.php

    r259 r268  
    619619 
    620620        $limitprev--; 
    621         $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"); 
     621        $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"); 
    622622        ++$querycount; 
    623623        if ($lastpost) { 
     
    660660        $limitnext--; 
    661661 
    662         $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"); 
     662        $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"); 
    663663        ++$querycount; 
    664664        if ($nextpost) {