我从这里的某个地方获取此代码,仅显示作者在仪表板中的评论。但它甚至没有在作者仪表板上显示任何单一评论或作者帖子。
请帮我纠正。
function my_plugin_get_comment_list_by_user($clauses) { if (is_admin()) { global $user_ID, $wpdb; $clauses['join'] = ", wp_posts"; $clauses['where'] .= " AND wp_posts.post_author = ".$user_ID." AND wp_comments.comment_post_ID = wp_posts.ID"; }; return $clauses; }; // Ensure that editors and admins can moderate all comments if(!current_user_can('edit_others_posts')) { add_filter('comments_clauses', 'my_plugin_get_comment_list_by_user'); }
答案 0 :(得分:0)
通过一些自定义来使用它:
<?php
$my_id = 7;
$comment_id_7 = get_comment( $my_id, ARRAY_A );
$name = $comment_id_7['comment_author'];
?>
另外用这个:
<div class="commentlist"><?php wp_list_comments(array('style' => 'div')); ?></div>