2010-03-28 24 views

回答

1

使用功能get_comment_text

$comment = get_comment_text(); 
var_dump($comment); 

未經檢驗的,但通常是由「的get_」在WordPress的回報前綴的直接呼應它的價值,而不是一個函數。

無論如何,您也需要作者的信息,所以您必須通過get_comments獲取評論並循環訪問它們。

http://codex.wordpress.org/Function_Reference/get_comments

$comments = get_comments('post_id=15'); 
    foreach($comments as $comm) : 
    echo($comm->comment_author); 
    endforeach; 
+0

啊這似乎是它的工作!只有一個問題,是否可以從帖子頁面獲取帖子的帖子ID? – tweetypi 2010-03-28 16:47:20

+1

是的,帖子循環中的the_ID()應該返回當前的帖子ID。再次使用get_the_ID()來返回它。 http://codex.wordpress.org/Template_Tags/the_ID – Alex 2010-03-28 17:29:15

相關問題