Advertisements

post_comment_meta_box

Definition:
function post_comment_meta_box($post) {}

Display comments for post.

Parameters

  • object $post

Source code

function post_comment_meta_box($post) {

	global $wpdb, $post_ID;



	$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 ( 1 > $total ) {

		echo '<p>' . __('No comments yet.') . '</p>';

		return;

	}



	wp_nonce_field( 'get-comments', 'add_comment_nonce', false );



	$wp_list_table = _get_list_table('WP_Post_Comments_List_Table');

	$wp_list_table->display( true );

?>

<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="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /></p>

<?php

	$hidden = get_hidden_meta_boxes('post');

	if ( ! in_array('commentsdiv', $hidden) ) { ?>

		<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>

<?php

	}

	wp_comment_trashnotice();

}

2559

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: