0
我使用wordpress get_comments()
,但它出現故障。在每篇文章的底部,我看到了相同的評論。我知道get_comments有一個ID attr,但我應該如何動態分配它?我在single.php中使用註釋並使用comment_template()
獲取它們;Wordpress獲得評論問題
在此先感謝
編輯
comment_form($comments_args);
$post_comments = get_comments();
?>
<?php
if ($post_comments)
{
?>
<section class='post-comments'>
<?php
foreach($post_comments as $comment_each)
{
$comment_each->comment_content;
}
?>
</section>
<?php
}
else
{
?>
<div class='no-comment'>
<?php
_e('No comments to show.');
?>
</div>
<?php
}
?>
雖然是
Get_comments不會發生故障,只需要被正確調用即可。向我們顯示您的代碼,我們可以幫助 – Anigel
有人請幫助我 –
嘗試get_comments(array('post_id'=> $ post-> ID)) – Anigel