Community Forums › Forums › Archived Forums › Design Tips and Tricks › Change Gravatar Size
Tagged: child theme, functions, gravatar
- This topic has 3 replies, 2 voices, and was last updated 11 years, 9 months ago by Gary Jones.
-
AuthorPosts
-
January 20, 2013 at 4:02 pm #13343IpstenuMember
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;
}
January 20, 2013 at 4:20 pm #13348Gary JonesMemberWhat? No code standards? No documentation? A number given as a string? 😉
https://gist.github.com/4582232
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
January 21, 2013 at 12:21 am #13419IpstenuMemberWhen 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;
}
March 1, 2013 at 4:41 am #23466Gary JonesMemberWhile 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.
WordPress Engineer, and key contributor the Genesis Framework | @GaryJ
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.