关于 WordPress 子主题 [英] About WordPress child theme
本文介绍了关于 WordPress 子主题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从父主题二十三"创建了 wordpress 子主题.我的儿童主题名称是twentythirteen-child".它有以下内容.
I have created wordpress child theme from parent theme "twentythirteen". My child theme name is "twentythirteen-child".It has following content.
/*
Theme Name: twentythirteen-child
Theme URI: http://www.example.com
Description: A Twenty Thirteen child theme
Author: WPBeginner
Author URI: http://www.example.com
Template: twentythirteen
Version: 1.0.0
*/
@import url("../twentythirteen/style.css");
不幸的是,当我激活子主题并且网页上没有应用父主题样式时,我的子主题替换了父主题并且新创建的主题正在应用.我怎么解决这个问题?
Unfortunately my child theme replaces the parent theme and newly created theme is applying when i activate child theme and there is no parent theme style is applied on webpage. How can i solve this problem?
推荐答案
要尝试的几件事:
- 仔细检查以确保您发布的标题中的模板路径实际上是 23 个主题.这可能就是基本样式没有出现的原因.
- 您的子主题需要它自己的
style.css
- 您不能导入它.在 WordPress 子主题法典页面上阅读更多内容. - 确保您没有将整个目录复制到子文件夹中.这是初学者常见的错误.
- 您的子主题应该覆盖父主题.它会取代您放入其中的任何父主题文件.例如,如果您在子主题的根目录中放置一个不同的
page.html
,它将替换 23 个父主题中的page.html
.立>
- Double check to make sure your template path in the header you posted actually goes to the twenty-thirteen theme. That could be why the base styles aren't appearing.
- Your child theme needs it's own
style.css
- you can't import that. Read more on the WordPress Child Theme Codex Page. - Make sure you didn't copy over the entire directory into the child folder. That's a common beginner mistake.
- Your child theme is supposed to override the parent theme. It supersedes any parent theme files you put into it. For example, if you put a different
page.html
in the root of your child theme, it would replace thepage.html
from the twenty-thirteen parent theme.
这篇关于关于 WordPress 子主题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文