WordPress.org

Make WordPress Core

Ticket #20937: 20937.trunk.diff

File 20937.trunk.diff, 1.8 KB (added by duck_, 12 months ago)
  • wp-admin/includes/meta-boxes.php

     
    476476        <p class="hide-if-no-js" id="add-new-comment"><a href="#commentstatusdiv" onclick="commentReply.addcomment(<?php echo $post_ID; ?>);return false;"><?php _e('Add comment'); ?></a></p> 
    477477        <?php 
    478478 
    479         $total = $wpdb->get_var($wpdb->prepare("SELECT count(1) FROM $wpdb->comments WHERE comment_post_ID = '%d' AND ( comment_approved = '0' OR comment_approved = '1')", $post_ID)); 
     479        $total = get_comments( array( 'post_id' => $post_ID, 'number' => 1, 'count' => true ) ); 
    480480        $wp_list_table = _get_list_table('WP_Post_Comments_List_Table'); 
    481481        $wp_list_table->display( true ); 
    482482 
    483483        if ( 1 > $total ) { 
    484484                echo '<p id="no-comments">' . __('No comments yet.') . '</p>'; 
    485485        } else { 
    486                 $hidden = get_hidden_meta_boxes('post'); 
     486                $hidden = get_hidden_meta_boxes( get_current_screen() ); 
    487487                if ( ! in_array('commentsdiv', $hidden) ) { 
    488488                        ?> 
    489489                        <script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script> 
    490490                        <?php 
    491491                } 
     492 
     493                ?> 
     494                <p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /></p> 
     495                <?php 
    492496        } 
    493497 
    494         ?> 
    495         <p class="hide-if-no-js hidden" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /></p> 
    496         <?php 
    497  
    498498        wp_comment_trashnotice(); 
    499499} 
    500500