Change Gravatar Size

Community Forums Forums Design Tips and Tricks Change Gravatar Size

This topic is: not resolved

This topic contains 3 replies, has 2 voices, and was last updated by  Gary Jones 1 year, 5 months ago.

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

    Ipstenu
    Participant
    Post count: 9

    I just wanted bigger pictures. Put this in your functions. (It’d be nice to be able to set that in Genesis Settings, but it may be rarely used).


    add_filter('genesis_comment_list_args', 'childtheme_comment_list_args');
    function childtheme_comment_list_args($args) {
    $args['avatar_size'] = '90';
    return $args;
    }

    #13348

    Gary Jones
    Moderator
    Post count: 686

    What? No code standards? No documentation? A number given as a string? ;-)

    https://gist.github.com/4582232


    Changes in Genesis 2.1 – the ultimate guide to every single change in Genesis Framework 2.1 and 2.1.1 (all 88 of them!) | @GaryJ

    #13419

    Ipstenu
    Participant
    Post count: 9

    When the documentation is nearly three times as long as the code, and the code is self-explanatory, I follow Otto’s rule ;)

    If anything, I’d do this for a site not my own:

    // Change default gravatar size in comments
    add_filter('genesis_comment_list_args', 'childtheme_comment_list_args');
    function childtheme_comment_list_args($args) {
    $args['avatar_size'] = '90'; // Value is side length of square avatar, in pixels.
    return $args;
    }

    #23466

    Gary Jones
    Moderator
    Post count: 686

    While you and Otto will find the code more than self-explanatory, there are some lower-level users who won’t immediately understand what’s going on with the snippet. There’s a couple of implicit assumptions that non-coders may not get from your first snippet:

    * The value passed in is an array, one which contains values for lots of comment-related stuff.
    * Avatars are square – by size, it means the length of a side, in pixels.

    In addition – your first extra comment says it’s for gravatars, and that may not be true. I didn’t see your second comment initially, as it’s tucked away with the code (in this non-syntax-highlighted environment).

    In six months time, when someone is looking at their code, wondering if they can use it on another project, or trying to remember what it does, then having a points of reference of who initially wrote it, and where they might have copied it from is going to be useful to them.

    Those developers who already fully document their code and perhaps use documentation generating applications appreciate being able to copy and paste an already-fully-documented snippet.

    It’s really not about the number of lines of documentation versus the number of lines of code – it’s about providing as many explanatory notes as possible for future you (or here, the rest of the Genesis community) about what the code does. Those who don’t need the full documentation can either delete it, or leave it in, with no ill-effect.

    We each have our own styles for private coding of course, but when you’re starting a new thread for the express purpose of sharing a useful bit of code, it makes sense to make that snippet use WP code standards and be as fully documented as possible, for the hundreds or thousands of people who will see or use it in their own projects, thereby saving them work, helping future them, and promoting good practice.


    Changes in Genesis 2.1 – the ultimate guide to every single change in Genesis Framework 2.1 and 2.1.1 (all 88 of them!) | @GaryJ

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.