post_comment_meta_box()
最后更新于:2021-11-27 18:57:07
post_comment_meta_box( GC_Post$post)Display comments for post.
参数
- $post
-
(GC_Post) (Required)
源文件
文件: gc-admin/includes/meta-boxes.php
function post_comment_meta_box( $post ) {
gc_nonce_field( 'get-comments', 'add_comment_nonce', false );
?>
<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>
<?php
$total = get_comments(
array(
'post_id' => $post->ID,
'number' => 1,
'count' => true,
)
);
$gc_list_table = _get_list_table( 'GC_Post_Comments_List_Table' );
$gc_list_table->display( true );
if ( 1 > $total ) {
echo '<p id="no-comments">' . __( 'No comments yet.' ) . '</p>';
} else {
$hidden = get_hidden_meta_boxes( get_current_screen() );
if ( ! in_array( 'commentsdiv', $hidden, true ) ) {
?>
<script type="text/javascript">jQuery(document).ready(function(){commentsBox.get(<?php echo $total; ?>, 10);});</script>
<?php
}
?>
<p class="hide-if-no-js" id="show-comments"><a href="https://https://docs.gechiui.com/" onclick="commentsBox.load(<?php echo $total; ?>);return false;"><?php _e( 'Show comments' ); ?></a> <span class="spinner"></span></p>
<?php
}
gc_comment_trashnotice();
}