Looking for help?
WordPress主题修改
目录
01 开启wordpress故障调试模式
- 打开wp-config.php
- 搜索WP_DEBUG或添加以下代码,其中WP_DEBUG_LOG为错误记录,可不添加;
define( 'WP_DEBUG', true);
define( 'WP_DEBUG_LOG', true);
02 创建子主题
要创建子主题,需要在wp-content/themes目录下新建一个子主题目录,再其下创建两个文件(这些是子主题的最低要求);其它相同内容可以,直接从父主题调用。
style.css——最少内容
/*
Theme Name: 子主题名称
Author: 作者名称
Theme URI: 主题作者网站
Template: 重要!!——其中Template为父主题的文件夹名
Version: 版本,如1.0.0
License: GNU General Public License v2 or later
*/
functions.php——从父主题中引入完整CSS样式表
<?php
/* Function to enqueue stylesheet from parent theme */
function child_enqueue__parent_scripts() {
wp_enqueue_style( 'parent', get_template_directory_uri().'/style.css' );
}
add_action( 'wp_enqueue_scripts', 'child_enqueue__parent_scripts');