Adding class to gravatar img in wordpress

后端 未结 4 1777
北恋
北恋 2021-02-08 13:26

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

4条回答
  •  野性不改
    2021-02-08 13:49

    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:

    $("img[class='avatar']").addClass("pic-2");
    

    Hope this helps! : )

提交回复
热议问题