子主题定制器不起作用

时间:2017-08-08 作者:Cakers

我的子主题自定义程序不工作。我从父主题创建了一个名为flash的子主题。在父主题中,我可以很好地使用定制器并更改布局等。然而,当我激活我的子主题时,我的定制器中没有任何布局方面的内容。我觉得问题在于我的风格。css注释。我对此进行了研究,每个人都不停地说这与插件有关,所以我一个接一个地停用和激活插件,没有任何问题。因此,我认为这与我如何将儿童主题联系起来有关。我对儿童主题还不熟悉,所以我可能觉得这和风格有什么关系。css评论,但如果有人知道为什么,请告诉我。

下面是我必须在样式中添加的注释示例。css。我还将在中包括flash主题的作者的评论。

我的孩子主题样式。css注释:

/*
Theme Name: flash-child
Theme URI: https://mywebsite.com/flash-child
Author: me
Author URI: https://mywebsite.com/flash-child
Description: Flash is free responsive multipurpose WordPress theme – truly a 
versatile theme perfect for any type of website you want. Like never before, 
it provides multiple pre-built demos which can be imported in seconds using 
ThemeGrill Demo Importer Plugin. The theme fully integrates with Flash 
Toolkit and SiteOrigin’s Page Builder Plugin that makes theme more user-
friendly and easy. Additionally, theme features multiple blog layouts, 
WooCommerce support, multiple header styles, multiple color options etc.
Version: 1.1.3
License: GNU General Public License v3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Text Domain: flash
Template: flash
Tags: one-column, two-columns, left-sidebar, right-sidebar, grid-layout, 
custom-background, custom-colors, custom-menu, custom-logo, featured-images, 
footer-widgets, full-width-template, theme-options, threaded-comments, 
translation-ready, blog, e-commerce

Flash is based on Underscores http://underscores.me/, (C) 2012-2016 
Automattic, Inc.
Underscores is distributed under the terms of the GNU GPL v2 or later.

Normalizing styles have been helped along thanks to the fine work of
Nicolas Gallagher and Jonathan Neal http://necolas.github.com/normalize.css/
 */
Flash(父级)主题注释样式。css:

/*
Theme Name: Flash
Theme URI: https://themegrill.com/themes/flash
Author: ThemeGrill
Author URI: https://themegrill.com
Description: Flash is free responsive multipurpose WordPress theme – truly a 
versatile theme perfect for any type of website you want. Like never before, 
it provides multiple pre-built demos which can be imported in seconds using 
ThemeGrill Demo Importer Plugin. The theme fully integrates with Flash 
Toolkit and SiteOrigin’s Page Builder Plugin that makes theme more user-
friendly and easy. Additionally, theme features multiple blog layouts, 
WooCommerce support, multiple header styles, multiple color options etc.
Version: 1.1.3
License: GNU General Public License v3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html
Text Domain: flash
Tags: one-column, two-columns, left-sidebar, right-sidebar, grid-layout, 
custom-background, custom-colors, custom-menu, custom-logo, featured-images, 
footer-widgets, full-width-template, theme-options, threaded-comments, 
translation-ready, blog, e-commerce

Flash is based on Underscores http://underscores.me/, (C) 2012-2016 
Automattic, Inc.
Underscores is distributed under the terms of the GNU GPL v2 or later.

Normalizing styles have been helped along thanks to the fine work of
Nicolas Gallagher and Jonathan Neal http://necolas.github.com/normalize.css/
*/

2 个回复
SO网友:Cakers

我意识到我不知道你需要一个额外的步骤来实现这些功能。php。这是我需要的最后一步。

<?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\' );
?>

SO网友:user0815

除上述内容外,请确保在您的样式中更新版本号。更新内容时的css文件。似乎customizer缓存了CSS,当它有旧版本号时不会更新它(即使站点可以正常工作)。

结束

相关推荐

Child-theme breaks site

所以,我有一个子主题,里面除了所需的CSS文件之外什么都没有。一旦我激活了这个儿童主题,我的整个网站就关闭了。最后我有两个问题:激活一个只有CSS的子主题怎么能破坏我的网站</我怎样才能回到我原来的主题</这些是网站给我的错误:Warning: require_once(/wp-content/themes/interio_child/admin/options-framework.php) [function.require-once]: 无法打开流:中没有此类文件或目录/wp-c