/wp-content/themes/你的主题名/整个文件夹打包下载。别嫌麻烦,一旦翻车,这叫“后悔药”。/wp-content/themes/里新建文件夹mytheme-child,再放两个文件:/*
Theme Name: MyTheme Child
Template: 原主题文件夹名
* /
@import url("../原主题文件夹名/style.css");
add_action('wp_enqueue_scripts', function () {
wp_enqueue_style('child-style', get_stylesheet_uri());
});style.css里,千万别直接动原主题,否则一更新全白瞎。functions.php。比如给文章页加“阅读量”:function add_reading_count() {
global $post;
$views = get_post_meta($post->ID, 'views', true);
echo '阅读量:'.($views ? $views : 0).'';
}
add_action('entry_footer', 'add_reading_count');js/custom.js,然后在functions.php里注册:add_action('wp_enqueue_scripts', function () {
wp_enqueue_script('my-custom', get_stylesheet_directory_uri().'/js/custom.js', 【'jquery'】, null, true);
});