post_comment_meta_box

Display comments for post.

Description

post_comment_meta_box( (object) $post ); 

Parameters (1)

0. $post (object)
The post.

Usage

  1. if ( !function_exists( 'post_comment_meta_box' ) ) { 
  2. require_once ABSPATH . '/wp-admin/includes/meta-boxes.php'; 
  3.  
  4. // The post. 
  5. $post = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = post_comment_meta_box($post); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-admin/includes/meta-boxes.php  
  1. function post_comment_meta_box( $post ) { 
  2. wp_nonce_field( 'get-comments', 'add_comment_nonce', false ); 
  3. ?> 
  4. <p class="hide-if-no-js" id="add-new-comment"><a class="button" href="#commentstatusdiv" onclick="window.commentReply && commentReply.addcomment(<?php echo $post->ID; ?>);return false;"><?php _e('Add comment'); ?></a></p> 
  5. <?php 
  6.  
  7. $total = get_comments( array( 'post_id' => $post->ID, 'number' => 1, 'count' => true ) ); 
  8. $wp_list_table->display( true ); 
  9.  
  10. if ( 1 > $total ) { 
  11. echo '<p id="no-comments">' . __('No comments yet.') . '</p>'; 
  12. } else { 
  13. if ( ! in_array('commentsdiv', $hidden) ) { 
  14. ?> 
  15. <script type="text/javascript">jQuery(document).ready(function() {commentsBox.get(<?php echo $total; ?>, 10);});</script> 
  16. <?php 
  17.  
  18. ?> 
  19. <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> 
  20. <?php 
  21.