Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/270.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 子主题不继承某些脚本和样式_Php_Wordpress - Fatal编程技术网

Php 子主题不继承某些脚本和样式

Php 子主题不继承某些脚本和样式,php,wordpress,Php,Wordpress,我使用这个主题: 我创建了一个儿童主题。我通过添加 function theme_enqueue_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri() . /style.css' ); } add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' ); 但某些东西并没有被应用,比如黏糊糊的headero

我使用这个主题: 我创建了一个儿童主题。我通过添加

    function theme_enqueue_styles() {
    wp_enqueue_style( 'parent-style', get_template_directory_uri() .  
    /style.css' );
    }
    add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );

但某些东西并没有被应用,比如黏糊糊的headeror移动菜单。还有什么我需要包括的吗?

您的子主题的样式表通常会自动加载。如果不是,您也需要将其排队。将“父样式”设置为依赖项将确保子主题样式表在它之后加载。请参见此处更详细的讨论:

<?php
function 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 )
    );
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
?>


并检查header.php。这不是最佳实践,但有时.js和.css在这个块中是“内联”的。谢谢,现在粘性标题也被应用了,但移动菜单仍然没有。我检查了header.php,但是js和css没有包含在内联中。。。