mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-12-06 12:51:58 +00:00
Comments post-box: show 10 comments at load only if the postbox is not hidden
git-svn-id: https://develop.svn.wordpress.org/trunk@9241 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -340,8 +340,9 @@ function post_comment_status_meta_box($post) {
|
||||
<label for="comment_status" class="selectit"> <input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> /> <?php _e('Allow comments on this post') ?></label>
|
||||
</p>
|
||||
<?php
|
||||
$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));
|
||||
|
||||
if ( !$post_ID || $post_ID < 0 || 0 == $post->comment_count )
|
||||
if ( !$post_ID || $post_ID < 0 || 1 > $total )
|
||||
return;
|
||||
|
||||
wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
|
||||
@@ -358,8 +359,13 @@ wp_nonce_field( 'get-comments', 'add_comment_nonce', false );
|
||||
<tbody id="the-comment-list" class="list:comment">
|
||||
</tbody>
|
||||
</table>
|
||||
<p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get();return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/loading.gif" alt="" /></p>
|
||||
<p class="hide-if-no-js"><a href="#commentstatusdiv" id="show-comments" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <img class="waiting" style="display:none;" src="images/loading.gif" alt="" /></p>
|
||||
<?php
|
||||
$hidden = (array) get_user_option( "meta-box-hidden_post" );
|
||||
if ( ! in_array('commentstatusdiv', $hidden) ) { ?>
|
||||
<script type="text/javascript">commentsBox.get(<?php echo $total; ?>, 10);</script>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
add_meta_box('commentstatusdiv', __('Comments on this Post'), 'post_comment_status_meta_box', 'post', 'normal', 'core');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user