【问题标题】:How to create child theme?如何创建儿童主题?
【发布时间】:2013-10-04 06:04:52
【问题描述】:

我在我的 Wordpress 网站中安装了 enfold 主题。我已经尝试过以下事情

1)我已经创建了一个名为 - enfold-child 的文件夹 2)我在该文件夹中创建了两个文件 1) 样式.css 2) 函数.php 3)父主题enfold截图

现在我已经像这样在 style.css 中放置了代码

/*
Theme Name: Enfold
Description: <strong>A superflexible and responsive Business Theme by Kriesi</strong> - <br/> Update notifications available on twitter and facebook:<br/> <a href='http://twitter.com/kriesi'>Follow me on twitter</a><br/> - <a href='http://www.facebook.com/pages/Kriesi/333648177216'>Join the Facebook Group</a>
Version: 2.2
Author: Kriesi
Author URI: http://www.kriesi.at
License: Themeforest Split Licence
License URI: -
Theme URI: www.kriesi.at/themes/enfold/
Template: enfold
*/

但是当我在管理面板中打开主题时,此消息会显示在 enfold child - 此子主题需要其父主题 Enfold。

我错在哪里了

我的 enfold 父主题有这样的代码

- /*
Theme Name: Enfold
Description: <strong>A superflexible and responsive Business Theme by Kriesi</strong> - <br/> Update notifications available on twitter and facebook:<br/> <a href='http://twitter.com/kriesi'>Follow me on twitter</a><br/> - <a href='http://www.facebook.com/pages/Kriesi/333648177216'>Join the Facebook Group</a>
Version: 2.2
Author: Kriesi
Author URI: http://www.kriesi.at
License: Themeforest Split Licence
License URI: -
Theme URI: www.kriesi.at/themes/enfold/
*/


/*
* PLEASE DO NOT EDIT THIS FILE!
* 
* This file is only in your themefolder for WordPress to recognize basic theme data like name and version
* CSS Rules in this file will not be used by the theme. 
* Instead use the custom.css file that is located in your themes /css/ folder to add your styles. 
* You can copy a style rule from any of your css files and paste it in custom.css and
* it will override the original style. If you just want to add small css snippets you might also
* want to consider to add it to the designated CSS option field in your themes backend at: Theme Options->Styling
*/

请帮忙

【问题讨论】:

    标签: wordpress wordpress-theming


    【解决方案1】:

    你不需要做任何事情,你可以下载现成的enfold子主题..只需复制以下链接并粘贴到浏览器的地址栏中...

    https://kriesi.at/files/enfold-child.zip

    如果您想创建自定义,请查看以下链接。

    https://vimeo.com/67221517

    我希望你会喜欢它.. :)

    【讨论】:

      【解决方案2】:

      您需要在子主题的style.css中添加如下代码

      /*
       Theme Name:     your child theme name
       Theme URI:      http://example.com/child-theme-url/
       Description:    your Child Theme desc
       Author:         your author name
       Author URI:     http://example.com
       Template:       enfold
       Version:        1.0.0
      */
      
      /* =Imports styles from the parent theme
      -------------------------------------------------------------- */
      @import url('../enfold/style.css');
      

      Template : 是您的父主题文件夹名称。 我希望这将有助于解决您的问题。

      【讨论】:

      • 我已经这样做了,但消息没有改变
      • 把模板名称设为你的父主题文件夹名称
      • 你能把网址放在这里吗?
      • 请检查您的父主题 style.css 文件
      【解决方案3】:

      您需要在子主题的 style.css 中包含 Template: enfold

      查看此儿童主题的官方 wordpress 文档链接http://codex.wordpress.org/Child_Themes 并特别阅读这部分:

      ....您可以更改每一行以适合您的主题。唯一的 必需的行是主题名称和模板。模板是 父主题的目录名称。在这种情况下,父主题 是 TwentyThirteen 主题,所以 Template 是二十三, 是 TwentyThirteen 主题所在目录的名称....

      【讨论】:

      • 我已经这样做了,但消息没有改变
      猜你喜欢
      • 1970-01-01
      • 2013-06-01
      • 1970-01-01
      • 2014-07-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-06
      • 2013-12-03
      相关资源
      最近更新 更多