如何创建儿童主题?

时间:2013-10-04 06:04:52

标签: wordpress wordpress-theming

我在Wordpress网站上安装了enfold主题。我试过了以下的事情

1)我创建了一个名为--enfold-child的文件夹    2)我在该文件夹中创建了两个文件       1)style.css       2)functions.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子项中 - 此子主题需要其父主题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
*/

请帮忙

3 个答案:

答案 0 :(得分:2)

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

<强> https://kriesi.at/files/enfold-child.zip

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

<强> https://vimeo.com/67221517

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

答案 1 :(得分:1)

您需要在子主题的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');

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

答案 2 :(得分:1)

您需要在子主题的style.css中加入Template: enfold

请参阅儿童主题http://codex.wordpress.org/Child_Themes&amp;的官方wordpress docs链接。特别阅读本部分:

  

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