Archive for May, 20082008-05-23T02:00:14ZF, Y

Adding New Default Gravatars To WordPress 2.6

Gravatar support was added into the WordPress core in 2.5. You could toggle them and chose what rating level (G/PG/PG13/R/X) you wanted to allow, but you couldn’t easily change the default avatar for users without a custom Gravatar. That is, until recently.

Earlier this month, Ryan committed a modified version of a patch I wrote. It adds a list of default avatars to the bottom of the discussion options page and has already been added to WordPress.com.

What does this mean for theme developers? Well, this new feature also allows you to define custom default avatars that better match your theme. Here is some example code that you would add to your theme’s functions.php:

<?php

add_filter( 'avatar_defaults', 'mytheme_addgravatar' );

function mytheme_addgravatar( $avatar_defaults ) {
	$myavatar = get_bloginfo('stylesheet_directory') . '/images/avatar.png';
	$avatar_defaults[$myavatar] = 'My Theme';
	return $avatar_defaults;
}

?>

That will add a new default avatar option to the bottom of the user’s settings page.

Clean Archives Reloaded v3.0.0

For those that haven’t noticed, I released a new version of Clean Archives Reloaded yesterday. It’s a major reworking of the plugin and it now requires WordPress 2.5 (due to functions it uses).

It’s now faster than before (I saw page generation times drop by about 10% on my test blog), an options page to configure the plugin, and much, much more.

So, upgrade today! :)

Page generated with 14 queries in 0.18687 seconds ( 99.36% PHP, 0.64% MySQL )