admin管理员组文章数量:1208155
My users need to see the date and time for each comment from the post edit page. Can anyone help me to display these metadata please?
Edit: When editing a post (cpt in my case) you can see the comments related to it and create new comments or answers. But the comments metabox only display username, email, IP, and comments content. I would like the date and time to be displayed for each comments, as it is already enabled in the front end or in the admin comments section.
Better with a picture maybe :
Sorry for my poor english...
My users need to see the date and time for each comment from the post edit page. Can anyone help me to display these metadata please?
Edit: When editing a post (cpt in my case) you can see the comments related to it and create new comments or answers. But the comments metabox only display username, email, IP, and comments content. I would like the date and time to be displayed for each comments, as it is already enabled in the front end or in the admin comments section.
Better with a picture maybe :
Sorry for my poor english...
Share Improve this question edited Dec 1, 2020 at 9:55 eliodata asked Nov 30, 2020 at 9:32 eliodataeliodata 11 bronze badge 1- You can display meta data by packing the php in short code and then add the short code everywhere. * Please add more info to question for clarity. – w3Abhishek Commented Nov 30, 2020 at 9:46
1 Answer
Reset to default 0Here is the answer given by Ferman on wpfr.net
function date_commentaire( ){
$comments = get_comments( array( 'post_id' => get_the_ID() ));
if ( doing_action( 'wp_ajax_get-comments' ) )
foreach ( $comments as $comment ) :
$a = $comment->comment_ID;
$b = get_comment_ID();
$date_comment = get_comment_date();
$time_comment = get_comment_time();
if ( $a==$b )
echo '<p class="commentaire-date">'.'Commentaire N°: '.$comment->comment_ID.' du: '.$date_comment.' à '.$time_comment.'</p>';
endforeach;
return $comment_author_url;
}
add_filter( 'get_comment_author_url','date_commentaire');
Works great. I just pasted it into functions.php child theme instead of using the advised plugin.
本文标签: Display date and time into post edit comments section
版权声明:本文标题:Display date and time into post edit comments section 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738745787a2110112.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论