Make WordPress Core


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r36158 r35748  
    737737    }
    738738
    739     if ( $cpage && get_option( 'page_comments' ) ) {
     739    if ( $cpage ) {
    740740        if ( $wp_rewrite->using_permalinks() ) {
    741741            if ( $cpage ) {
     
    13141314            // If fetching the first page of 'newest', we need a top-level comment count.
    13151315            $top_level_query = new WP_Comment_Query();
    1316             $top_level_args  = array(
     1316            $top_level_count = $top_level_query->query( array(
    13171317                'count'   => true,
    13181318                'orderby' => false,
    13191319                'post_id' => $post->ID,
    13201320                'parent'  => 0,
    1321                 'status'  => 'approve',
    1322             );
    1323 
    1324             if ( isset( $comment_args['include_unapproved'] ) ) {
    1325                 $top_level_args['include_unapproved'] = $comment_args['include_unapproved'];
    1326             }
    1327 
    1328             $top_level_count = $top_level_query->query( $top_level_args );
     1321            ) );
    13291322
    13301323            $comment_args['offset'] = ( ceil( $top_level_count / $per_page ) - 1 ) * $per_page;
     
    13381331    $comments_flat = array();
    13391332    foreach ( $_comments as $_comment ) {
    1340         $comments_flat[]  = $_comment;
    1341         $comment_children = $_comment->get_children( array(
     1333        $comments_flat = array_merge( $comments_flat, array( $_comment ), $_comment->get_children( array(
    13421334            'format' => 'flat',
    13431335            'status' => $comment_args['status'],
    13441336            'orderby' => $comment_args['orderby']
    1345         ) );
    1346 
    1347         foreach ( $comment_children as $comment_child ) {
    1348             $comments_flat[] = $comment_child;
    1349         }
     1337        ) ) );
    13501338    }
    13511339
     
    19251913     */
    19261914    $r = apply_filters( 'wp_list_comments_args', $r );
    1927 
    1928     /*
    1929      * If 'page' or 'per_page' has been passed, and does not match what's in $wp_query,
    1930      * perform a separate comment query and allow Walker_Comment to paginate.
    1931      */
    1932     if ( is_singular() && ( $r['page'] || $r['per_page'] ) ) {
    1933         $current_cpage = get_query_var( 'cpage' );
    1934         if ( ! $current_cpage ) {
    1935             $current_cpage = 'newest' === get_option( 'default_comments_page' ) ? 1 : $wp_query->max_num_comment_pages;
    1936         }
    1937 
    1938         $current_per_page = get_query_var( 'comments_per_page' );
    1939         if ( $r['page'] != $current_cpage || $r['per_page'] != $current_per_page ) {
    1940             $comments = get_comments( array(
    1941                 'post_id' => get_queried_object_id(),
    1942                 'orderby' => 'comment_date_gmt',
    1943                 'order' => 'ASC',
    1944                 'status' => 'all',
    1945             ) );
    1946         }
    1947     }
    19481915
    19491916    // Figure out what comments we'll be looping through ($_comments)
Note: See TracChangeset for help on using the changeset viewer.