首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Get_avatar过滤器?

Get_avatar过滤器?
EN

WordPress Development用户
提问于 2018-09-24 17:32:51
回答 1查看 214关注 0票数 1

我试着在下面的评论中显示一些东西。我怎么过滤这个?对不起,我是Wordpress PHP开发的新手。

在“我的孩子”主题的comment.php中,我有:

代码语言:javascript
复制
wp_list_comments(
    array(
        'style'       => 'ol',
        'short_ping'  => true,
        'avatar_size' => 60,
    )

);

我想,我必须在这里或在functions.php做些事情

EN

回答 1

WordPress Development用户

回答已采纳

发布于 2018-09-24 17:50:09

我从商店WordPress主题中给出了例子,因为它是最好的主题,它解释了您想知道的一切,所以这里的代码是comments.php

代码语言:javascript
复制
 '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'] ) ) ); ?>
    
    
    
    
    
    
}在行下,您可以看到化身图像正在获取,并在其下面显示自定义数据。您可以根据自己的喜好定制它。
票数 1
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/315022

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档