Changes from branches/4.4/src/wp-includes/comment-template.php at r36158 to trunk/src/wp-includes/comment-template.php at r35748
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment-template.php
r36158 r35748 737 737 } 738 738 739 if ( $cpage && get_option( 'page_comments' )) {739 if ( $cpage ) { 740 740 if ( $wp_rewrite->using_permalinks() ) { 741 741 if ( $cpage ) { … … 1314 1314 // If fetching the first page of 'newest', we need a top-level comment count. 1315 1315 $top_level_query = new WP_Comment_Query(); 1316 $top_level_ args =array(1316 $top_level_count = $top_level_query->query( array( 1317 1317 'count' => true, 1318 1318 'orderby' => false, 1319 1319 'post_id' => $post->ID, 1320 1320 '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 ) ); 1329 1322 1330 1323 $comment_args['offset'] = ( ceil( $top_level_count / $per_page ) - 1 ) * $per_page; … … 1338 1331 $comments_flat = array(); 1339 1332 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( 1342 1334 'format' => 'flat', 1343 1335 'status' => $comment_args['status'], 1344 1336 'orderby' => $comment_args['orderby'] 1345 ) ); 1346 1347 foreach ( $comment_children as $comment_child ) { 1348 $comments_flat[] = $comment_child; 1349 } 1337 ) ) ); 1350 1338 } 1351 1339 … … 1925 1913 */ 1926 1914 $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 }1948 1915 1949 1916 // Figure out what comments we'll be looping through ($_comments)
Note: See TracChangeset
for help on using the changeset viewer.