我无法在wordpress中看到我的孩子主题自定义gravatar

时间:2015-01-13 01:10:05

标签: php wordpress

我在创建新的gravatar时遵循wordpress codex。虽然我遵循了指示,但我看不到我的新格拉瓦尔:

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

1 个答案:

答案 0 :(得分:0)

你可以试试这个:

//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;
}