[Resolved] avatar size in comments

Home Forums Support avatar size in comments

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
  • #156485


    i would like avatars in comments of 80px width instead of 50px width in my child theme.

    i dupplicate the comment.php to my child theme

    i found in the parent theme file : inc/template-tags.php the

    $args['avatar_size'] = 50;

    But i don’t know how to change this value without modify the parent theme “template-tags.php”.

    (I am a beginner )


    Lead Developer
    Lead Developer

    Hi there,

    I just added a new filter into the next version which will make this easier.

    First, find this in the template-tags.php file:

    $args['avatar_size'] = 50;

    And replace it with this:

    $args['avatar_size'] = apply_filters( 'generate_comment_avatar_size', 50 );

    Then add this function:

    add_filter( 'generate_comment_avatar_size','generate_change_avatar_size' );
    function generate_change_avatar_size()
        return 80;

    Adding PHP: https://generatepress.com/knowledgebase/adding-php-functions/



    Thank you, it’s working !
    ( I put your “add filter” code into my child theme’s function.php )

    So in the next version of GeneratePress,$args['avatar_size'] = apply_filters( 'generate_comment_avatar_size', 50 ); will not be undone ?

    Thanks !

    Lead Developer
    Lead Developer


    That’s correct, the next version will include the filter by default 🙂

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.