0
A
回答
0
你只需要按照以下3个步骤:
1)在/可湿性粉剂内容的主题创建一个文件夹/主题/:
“建议(虽然不是必需的,尤其是如果你正在创建一个供公众使用的主题),你的子主题目录的名称会附加'-child'。“。
这里创建的每个文件都会覆盖父主题中的文件。例如,您可以创建新的页面模板:https://developer.wordpress.org/themes/template-files-section/page-template-files/或覆盖现有的模板。
2)创建是一个style.css的文件,并开始它:
/*
Theme Name: Twenty Fifteen Child
Theme URI: http://example.com/twenty-fifteen-child/
Description: Twenty Fifteen Child Theme
Author: John Doe
Author URI: http://example.com
Template: twentyfifteen
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: twenty-fifteen-child
*/
这里添加您的自定义样式。更多信息:https://codex.wordpress.org/Theme_Development#Theme_Stylesheet
3)创建的functions.php
在这个文件中,你可以添加新的功能,你的孩子的主题或修改现有的。
您还需要在这里入队您的父主题的CSS和JS,以及您在子主题上创建的新CSS和JS。类似的东西会做大部分的时间:
<?php
function my_theme_enqueue_styles() {
$parent_style = 'parent-style'; // This is 'twentyfifteen-style' for the Twenty Fifteen theme.
wp_enqueue_style($parent_style, get_template_directory_uri() . '/style.css');
wp_enqueue_style('child-style',
get_stylesheet_directory_uri() . '/style.css',
array($parent_style),
wp_get_theme()->get('Version')
);
}
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');
?>
现在,您可以添加自定义的简(https://codex.wordpress.org/Shortcode_API),窗口小部件区域(https://codex.wordpress.org/Widgetizing_Themes)等。
更多的文档关于儿童主题:https://codex.wordpress.org/Child_Themes
相关问题
- 1. WordPress的儿童主题覆盖父母的主题包括
- 2. WordPress儿童主题
- 3. WordPress的/儿童主题 - 加载父母的选项
- 4. removeView()对儿童的父母
- 5. WordPress的儿童主题风格过了父母的主题风格
- 6. WordPress的儿童主题
- 7. WordPress的儿童主题include_once
- 8. WordPress的儿童主题&enqueue_script
- 9. WordPress的functions.php儿童主题
- 10. WordPress中的儿童主题也有自己的儿童主题
- 11. wordpress儿童主题functions.php
- 12. wordpress儿童主题多个儿童主题wp_enqueue_scripts
- 13. WordPress主题图片儿童主题
- 14. WordPress的:处理儿童和父母主题之间的CSS优先
- 15. WordPress的 - 从父主题主题选项是缺少儿童主题
- 16. Wordpress儿童主题CSS问题
- 17. Flexboxs儿童溢出父母
- 18. 父母儿童微调器
- 19. WordPress的儿童主题style.css不工作
- 20. WordPress的儿童主题css优先
- 21. WordPress的儿童主题如何工作?
- 22. WordPress的儿童主题CSS路径
- 23. WordPress的儿童主题CSS入队
- 24. WordPress的儿童主题 - 一般了解
- 25. WordPress的儿童主题:覆盖功能
- 26. 多个WordPress的儿童主题
- 27. WordPress的:编辑儿童主题
- 28. WordPress的儿童主题路径
- 29. WordPress的儿童主题和页脚
- 30. 儿童主题文件无法覆盖到父主题文件
你可能会更好地服务于https://wordpress.stackexchange.com/ –
看看这里:https://codex.wordpress.org/Child_Themes – mmm