Php 在wordpress模板中加载特定帖子的评论
您好,我使用此代码加载特定帖子的内容和信息:Php 在wordpress模板中加载特定帖子的评论,php,wordpress,comments,Php,Wordpress,Comments,您好,我使用此代码加载特定帖子的内容和信息: if ($actual_link == $wpbase){ $recent_posts = wp_get_recent_posts('1'); foreach( $recent_posts as $recent ){ echo '<article id="post-'.$recent["ID"].'"><h1>' . $recent["post_title"] .
if ($actual_link == $wpbase){
$recent_posts = wp_get_recent_posts('1');
foreach( $recent_posts as $recent ){
echo '<article id="post-'.$recent["ID"].'"><h1>' .
$recent["post_title"] .
'</h1>' .
apply_filters('the_content', $recent["post_comments"]) .
'</article><aside>' .
$recent["post_content"].
'</aside>';
};
}
if($actual_link==$wpbase){
$recent_posts=wp_get_recent_posts('1');
foreach(最近发布的文章为$recent){
回显“”。
$Recentary[“post_title”]。
'' .
应用_过滤器(_内容,$recent[“post_comments”])。
'' .
$recent[“post_内容”]。
'';
};
}
但不知何故,最后一个表达式$recent[“post_comments”]
没有返回任何内容。甚至没有原始的评论文本。我做错什么了吗?我尝试了不同的语法,也使用了wp\u list\u注释($args)代码>但从未真正起作用
有什么办法让它工作吗?
谢谢你的帮助 不返回帖子评论,请查看以查看可用字段
将显示注释列表,但您应该在内部使用它
但是你可以用它来获得一系列评论,看看codex上的例子
PS:您使用wp\u get\u recent\u posts的方式已被弃用,您应该使用数组而不是'1'
谢谢,我会看一看。我如何将其写为数组s