我试着在下面的评论中显示一些东西。我怎么过滤这个?对不起,我是Wordpress PHP开发的新手。
在“我的孩子”主题的comment.php中,我有:
wp_list_comments(
array(
'style' => 'ol',
'short_ping' => true,
'avatar_size' => 60,
)
);我想,我必须在这里或在functions.php做些事情
发布于 2018-09-24 17:50:09
我从商店WordPress主题中给出了例子,因为它是最好的主题,它解释了您想知道的一切,所以这里的代码是comments.php
'ol',
'short_ping' => true,
'callback' => 'storefront_comment',
) );
?>这里,storefront_comment是一个回调函数,它是在位于inc文件夹的storefront-template-functions.php中定义的。这里的函数代码if ( ! function_exists( 'storefront_comment' ) ) {
/**
* Storefront comment template
*
* @param array $comment the comment array.
* @param array $args the comment args.
* @param int $depth the comment depth.
* @since 1.0.0
*/
function storefront_comment( $comment, $args, $depth ) {
if ( 'div' == $args['style'] ) {
$tag = 'div';
$add_below = 'comment';
} else {
$tag = 'li';
$add_below = 'div-comment';
}
?>
< id="comment-">
%s', 'storefront' ), get_comment_author_link() ); ?>
comment_approved ) : ?>
' . get_comment_date() . ''; ?>
$add_below, 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
}在行下,您可以看到化身图像正在获取,并在其下面显示自定义数据。您可以根据自己的喜好定制它。https://wordpress.stackexchange.com/questions/315022
复制相似问题