WordPress.org

Make WordPress Core

Ticket #12650: link-template.patch

File link-template.patch, 1.3 KB (added by layotte, 4 years ago)

Patch created from previously attached PHP file...

  • link-template.php

     
    10221022        } 
    10231023 
    10241024        $adjacent = $previous ? 'previous' : 'next'; 
    1025         $op = $previous ? '<' : '>'; 
     1025        $op = $previous ? '<=' : '>='; // include current time 
     1026        $ope = $previous ? '<' : '>'; // exclude current id 
    10261027        $order = $previous ? 'DESC' : 'ASC'; 
    10271028 
    10281029        $join  = apply_filters( "get_{$adjacent}_post_join", $join, $in_same_cat, $excluded_categories ); 
    1029         $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare("WHERE p.post_date $op %s AND p.post_type = %s AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date, $post->post_type), $in_same_cat, $excluded_categories ); 
    1030         $sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order LIMIT 1" ); 
     1030        $where = apply_filters( "get_{$adjacent}_post_where", $wpdb->prepare("WHERE p.post_date $op %s AND p.ID $ope %s AND p.post_type = %s AND p.post_status = 'publish' $posts_in_ex_cats_sql", $current_post_date, $post->ID, $post->post_type), $in_same_cat, $excluded_categories ); 
     1031        $sort  = apply_filters( "get_{$adjacent}_post_sort", "ORDER BY p.post_date $order, p.ID $order LIMIT 1" ); 
    10311032 
    10321033        $query = "SELECT p.* FROM $wpdb->posts AS p $join $where $sort"; 
    10331034        $query_key = 'adjacent_post_' . md5($query);