WordPress.org

Make WordPress Core

Ticket #46963: 46963.2.patch

File 46963.2.patch, 1.9 KB (added by hardipparmar, 7 months ago)

In the above patch, file patch is not included so I have created another patch. Please consider this new patch for this issue.

  • wp-admin/includes/meta-boxes.php

     
    807807        <p class="hide-if-no-js" id="add-new-comment"><button type="button" class="button" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);"><?php _e( 'Add comment' ); ?></button></p>
    808808        <?php
    809809
    810         $total        = get_comments(
     810        $wp_get_comments = get_comments(
    811811                array(
    812812                        'post_id' => $post->ID,
    813813                        'number'  => 1,
    814                         'count'   => true,
    815814                )
    816815        );
     816
     817        $total = get_comments_number( $post->ID );
     818        if ( 0 !== count( $wp_get_comments ) ) {
     819                // Get the comment type (comment, trackback),
     820                $comment_type = ( ! empty( $wp_get_comments[0]->comment_type ) ) ? $wp_get_comments[0]->comment_type : 'comment';
     821        }
    817822        $wp_list_table = _get_list_table( 'WP_Post_Comments_List_Table' );
    818823        $wp_list_table->display( true );
    819824
     
    828833                }
    829834
    830835                ?>
    831                 <p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.load(<?php echo $total; ?>);return false;"><?php _e( 'Show comments' ); ?></a> <span class="spinner"></span></p>
     836                <p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.load(<?php echo $total; ?>,'<?php echo $comment_type; ?>');return false;"><?php _e( 'Show comments' ); ?></a> <span class="spinner"></span></p>
    832837                <?php
    833838        }
    834839
  • wp-admin/js/post.js

     
    9595                 *
    9696                 * @memberof commentsBox
    9797                 */
    98                 load: function(total){
    99                         this.st = jQuery('#the-comment-list tr.comment:visible').length;
     98                load: function(total,comment_type){
     99                        this.st = jQuery('#the-comment-list tr.'+comment_type+':visible').length;
    100100                        this.get(total);
    101101                }
    102102        };