繁体   English   中英

我在Wordpress中看不到我的孩子主题自定义图像

[英]I can't see my child theme custom gravatar in 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;
}

使用检查元素,头像目录为: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;
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM