Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/38.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 wp_排队_样式在子主题中不起作用_Php_Css_Wordpress - Fatal编程技术网

Php wp_排队_样式在子主题中不起作用

Php wp_排队_样式在子主题中不起作用,php,css,wordpress,Php,Css,Wordpress,因此,我有这个子主题,当我尝试将样式和javascript排队时,我遇到了一个错误: wp_enqueue_脚本工作正常 wp_排队_风格根本不起作用 wp_head()包含在标题中,它以前工作过,但在更新Avast主题和wordpress后,问题开始出现 functions.php function theme_enqueue_styles() { wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() .

因此,我有这个子主题,当我尝试将样式和javascript排队时,我遇到了一个错误:

  • wp_enqueue_脚本工作正常
  • wp_排队_风格根本不起作用
wp_head()包含在标题中,它以前工作过,但在更新Avast主题和wordpress后,问题开始出现

functions.php

function theme_enqueue_styles() {

    wp_enqueue_style( 'child-style', get_stylesheet_directory_uri() . '/style.css'); //not working
    wp_enqueue_style( 'fancy', get_stylesheet_directory_uri() . '/css/jquery.fancybox.min.css'); //not working
    wp_enqueue_script( 'devtools', get_stylesheet_directory_uri() . '/js/main.min.js' ); //working

}

add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
查看文档

在那里你可以找到这条线

add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
function my_theme_enqueue_styles() {
    wp_enqueue_style( 'child-style', get_stylesheet_uri(),
        array( 'parenthandle' ), 
        wp_get_theme()->get('Version') // this only works if you have Version in the style header
    );
}

谢谢,成功了!有趣的是,在WP 5.7.2更新之前,它没有出现任何问题。