我刚刚创建了一个子主题并激活了它。但是当我访问这个页面时,它是完全空白的。
显示的是主题文件夹,其中有父主题和子主题,下面是父样式中的站点详细信息。css,我只是复制并粘贴到子样式表中。

功能。php如下所示:
<?php
function my_theme_enqueue_styles() {
$parent_style = \'parent-style\';
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网友:Jitender Singh
<小时>
*
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
*/
请仔细参阅wordpress编码标准。您忘记了定义
Template 你父母的主题。请定义
Template 然后查看。希望这会有所帮助!