我遵循wordpress法典创建了一个新的gravatar。我看不到我的新gravatar,尽管我遵循了以下说明:
http://codex.wordpress.org/How_to_Use_Gravatars_in_WordPress
add_filter( 'avatar_defaults', 'new_default_avatar' );
function new_default_avatar ( $avatar_defaults ) {
//Set the URL where the image file for your avatar is located
$new_avatar_url = get_bloginfo( 'template_directory' ) . '/images/new_default_avatar.png';
//Set the text that will appear to the right of your avatar in Settings>>Discussion
$avatar_defaults[$new_avatar_url] = 'Your New Default Avatar';
return $avatar_defaults;
}
使用inspect元素,化身目录是:avatar_http://www.Domain.com/wp-content/themes/PARENT/images/gravatar.png
我无法获得这样的函数:avatar_http://www.Domain.com/wp-content/themes/CHILD/images/gravatar.png
您可以尝试以下方法:
//Custom Child Gravatar
add_filter( 'avatar_defaults', 'new_custom_default_gravatar' );
function new_custom_default_gravatar ($avatar_defaults) {
$myavatar = get_stylesheet_directory_uri() . '/images/new_default_avatar.png';
$avatar_defaults[$myavatar] = "Your New Default Avatar";
return $avatar_defaults;
}