Make WordPress Core

Ticket #2415: 2415.diff

File 2415.diff, 2.0 KB (added by mdawaffe, 19 years ago)

why not go nuts?

  • wp-includes/link-template.php

     
    296296                $posts_in_ex_cats_sql = 'AND ID NOT IN (' . implode($posts_in_ex_cats, ',') . ')';
    297297        }
    298298
    299         return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts $join WHERE post_date < '$current_post_date' AND post_type = 'post' AND post_status = 'publish' $posts_in_ex_cats_sql ORDER BY post_date DESC LIMIT 1");
     299        $join  = apply_filters( 'prev_next_post_join', $join, $in_same_cat, $excluded_categories );
     300        $where = apply_filters( 'prev_next_post_where', "WHERE post_date < '$current_post_date' AND post_type = 'post' AND post_status = 'publish' $posts_in_ex_cats_sql", $in_same_cat, $excluded_categories );
     301        $sort  = apply_filters( 'prev_next_post_sort', 'ORDER BY post_date DESC LIMIT 1', $in_same_cat, $excluded_categories );
     302
     303        return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts $join $where $sort");
    300304}
    301305
    302306function get_next_post($in_same_cat = false, $excluded_categories = '') {
     
    329333                $posts_in_ex_cats_sql = 'AND ID NOT IN (' . implode($posts_in_ex_cats, ',') . ')';
    330334        }
    331335
    332         return @$wpdb->get_row("SELECT ID,post_title FROM $wpdb->posts $join WHERE post_date > '$current_post_date' AND post_type = 'post' AND post_status = 'publish' $posts_in_ex_cats_sql AND ID != $post->ID ORDER BY post_date ASC LIMIT 1");
     336        $join  = apply_filters( 'prev_next_post_join', $join, $in_same_cat, $excluded_categories );
     337        $where = apply_filters( 'prev_next_post_where', "WHERE post_date > '$current_post_date' AND post_type = 'post' AND post_status = 'publish' $posts_in_ex_cats_sql AND ID != $post->ID", $in_same_cat, $excluded_categories );
     338        $sort  = apply_filters( 'prev_next_post_sort', 'ORDER BY post_date ASC LIMIT 1', $in_same_cat, $excluded_categories );
     339
     340        return @$wpdb->get_row("SELECT ID, post_title FROM $wpdb->posts $join $where $sort");
    333341}
    334342
    335343