Change the default Gravatar in WordPress 2.7x
Version: 19.1
Revision: 13 Build 16
Change the default Gravatar in WordPress 2.7x
Introduction: this article was designed to assist users with their default avatar.
But, this article was a request by a user from Germany. He asked me nicely if I could write an article about: changing the default “gravatar” in WordPress 2.7.x
Happy gravatar!
Warning: changing the “functions.php” file outside the server, this could trigger “Syntax” issues and errors. So, my best advice is: disable your original theme then add / remove a specific code – within the server.
1.] Login to your Cpanel or WordPress Control panel and go to your theme’s directory.
2.] Add this code into your “functions.php” files.
File: functions.php
—Copy Source Code—
<?php
/*
Plugin Name: Avatar Prototype
Author: Lair360
Version: 2.21a
Revision: 19 Build 33
*/
if ( !function_exists('fs_addgravatar') ) {
function fs_addgravatar( $avatar_defaults ) {
$myavatar = get_bloginfo('template_directory') . '/images/template-demo1.png';
$avatar_defaults[$myavatar] = 'name';
$myavatar2 = get_bloginfo('template_directory') . '/images/template-demo2.png';
$avatar_defaults[$myavatar2] = 'name';
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'fs_addgravatar' );
}
?>
—End Source Code—
Notes: you’ll need to replace “template-demo.png” with your own image.
However, please keep the “image” directory intact. But, if you remove it, the picture will not show! Also, if you only want to add one avatar, you’ll need to remove one of these codes…
——————————
$myavatar2 = get_bloginfo('template_directory') . '/images/template-demo2.png';
$avatar_defaults[$myavatar2] = 'name';
3.] Save your progress and open this file: “comments.php”, then add this code…
File: comments.php
—Copy Source Code—
<?php wp_list_comments(array('avatar_size'=>70, )); ?>
—End Source Code—
4.] Save your progress and have fun changing your “gravatar”!
Copyrighted by Lair360


