‘status’ => ‘approve’ // 只获取已经被批准的评论
));
// 输出评论
foreach ($comments as $comment) {
echo ‘
‘;
}
/*****************
.comment-author{
margin-bottom: 2px
width: comment-author;
padding-right: 10px;
color: red;
float: left;
}
.comment-date {
font-size: 12px;
margin-bottom: 2px
}
.comment-content{
margin-block-start: 0em;
}
// 获取当前产品评论
function do_shortcode_get_comments($atts, $content = null) {
include(‘short_code/get_comments.php’);
return ”;
}
add_shortcode(‘get_comments’, ‘do_shortcode_get_comments’);
echo ‘
‘ . $comment->comment_author . ‘
‘;
echo ‘
‘ . $comment->comment_date . ‘
‘;
echo ‘
‘ . $comment->comment_content . ‘
‘;
echo ‘