I've been trying to use get_avatar to display the author's gravatar under each post in wordpress template with applied class but I couldn`t find a way to add class="pic-2" to gravatar image code or even changing gravatar heigth and width to 100px and 77px respectively
<?php echo get_avatar( get_the_author_meta('ID'), 32 ); ?>
Any help guys ??
Check out the WordPress Codex for more info:
http://codex.wordpress.org/Using_Gravatars
For the size, try wrapping the second parameter like so:
The default html output is like so:
You can style the default class 'avatar' in place of 'pic-2'. If you still want to add a class , you can do it via javascript like so:
Hope this helps! : )
I think the best way to handle this would be to use a filter, rather than using jQuery as George suggests. You would simply add this to your theme's functions.php file.
*Note, I've not tested this, but believe it will work. See this thread for more info.
Another way to do this for future searchers, very simple string manipulation which is probably a bit safer if they change the function in the future e.g. it'll likely always have a 'class'.
If @Ryan answer (marked as solution) does'nt work for you, try to change
into
This start's work for me after replace " with '.
Sorry that I didn't write this as a comment to that answer, but I don't have 50 reputation to comment other posts.