我试图在foreach循环中显示一个注释框,但是comment\\u form函数会先输出其他内容。这是我正在尝试的代码。一切都在展示,只是不在正确的地方。有什么想法或不同的方法吗?
// get comments
$achievment_post .= \'<ol class="commentlist">\';
//Gather comments for a specific page/post
$comments = get_comments(array(
\'post_id\' => $achievment->ID,
\'status\' => \'approve\'
));
$achievment_post .= wp_list_comments(array(
\'per_page\' => 10, // Allow comment pagination
\'reverse_top_level\' => false //Show the latest comments at the top of the list
), $comments);
$achievment_post .= \'</ol>\';
// comment box
$achievment_post .= comment_form($args , $achievment->ID);