Bootstrap Templates Bundle

Sunday, January 20, 2013

Change Default Gravatars in Wordpress

If you want to show different Gravatars for diffident user then tell your user to Create an account in Gravatar.com 


* Use the mail id that you want to use for these purpose

*Choose the image from your Computer/ from internet/ previously uploaded. In this way click on next step

*After you've complete your gravatar.com image will appear as your gravatar whenever you post on your own blog or post a comment by using this mail ID

*If you want to to change your default Gravatars then you need to change some code in your functions.php file. Remember that , this default gravatar can be seen only that time if your user do not have any gravatar from gravatar.com for his used mail Id


*Use this code above the last line of your functions.php file

/* Powerusers Gravatar
/* ----------------------------------------------*/
add_filter( 'avatar_defaults', 'newgravatar' );  

function newgravatar ($avatar_defaults) {
     $myavatar = get_bloginfo('template_directory') . '/images/p-gravatar.jpg';
     $avatar_defaults[$myavatar] = "Powerusers Gravatar";
     return $avatar_defaults;
}


* Change the  /images/p-gravatar.jpg by your own of above code
*  Go to your Dashboard->Setting->Discussion.
* Then you can see the the difference
* You can style the gravatar from your style.css file 
* Find out the code below to style as you wish

.commentlist .avatar {
    border: 3px solid #ffffff;                               
    margin-right: 10px; 
    width: 40px; 
    height: 40px; 
    vertical-align: middle;
    margin-bottom: 2px;
}
.comments-widget-avatar {
    border: 1px solid #BDBDBD;
    padding: 4px;
    background-color: #fff;
}

No comments:

Post a Comment

Wokiee React eCommerce Template