简体   繁体   English

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

[英]I can't see my child theme custom gravatar in wordpress

I am following the wordpress codex in creating a new gravatar. 我在创建新的Gravatar时遵循Wordpress Codex。 I can't see my new gravatar although I followed the instructions: 尽管按照说明进行操作,但我看不到新的图像:

http://codex.wordpress.org/How_to_Use_Gravatars_in_WordPress 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;
}

Using inspect element, the avatar directory is: avatar_http://www.Domain.com/wp-content/themes/PARENT/images/gravatar.png 使用检查元素,头像目录为:avatar_http://www.Domain.com/wp-content/themes/PARENT/images/gravatar.png

I can't get the function read it this way: avatar_http://www.Domain.com/wp-content/themes/CHILD/images/gravatar.png 我无法以这种方式读取该函数:avatar_http://www.Domain.com/wp-content/themes/CHILD/images/gravatar.png

You can try this: 您可以尝试以下方法:

//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.

相关问题 为什么在此WordPress主题中我看不到主菜单? - Why in this WordPress theme I can't see the Main Menu? 我可以允许我的作者将他们的头像更改为自定义图像吗? - Can I allow my author's to change their gravatar to a custom image? WordPress子主题:如何从父主题向子主题添加自定义样式表? - WordPress Child Theme: How do I add a custom style sheet from my parent theme to my child theme? 无法在我的自定义 wordpress 主题中使用 smarty 模板引擎 - Can't use smarty templating engine in my custom wordpress theme 我在 wordpress admin 中看不到我在主题中创建的菜单 - I cannot see the menu that I create in my theme, in wordpress admin 如何在Wordpress儿童主题自定义程序中为单选按钮选项输入正确的图像路径URL? - How can I put in a proper image path URL for radio button options in my Wordpress Child Theme Customizer? 如何将类别和标签描述合并到我的 WordPress 子主题中? - How can I incorporate category and tag descriptions into my WordPress child theme? Wordpress 自定义主题 - javascript 无法读取我页面上的任何元素 - Wordpress custom theme - javascript can't read any element on any of my page 我的页眉和页脚菜单无法同时显示在我的wordpress主题中 - I can't get both my header and footer menus to display properly in my wordpress theme 如何指定自定义WordPress主题的区域必须包含小部件\\模块? - How can I specify that an area of my custom WordPress theme have to contains widgets\modules?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM