Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/33.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
Html 在wordpress中将style.css放在其他css的下面_Html_Css_Wordpress - Fatal编程技术网

Html 在wordpress中将style.css放在其他css的下面

Html 在wordpress中将style.css放在其他css的下面,html,css,wordpress,Html,Css,Wordpress,我是wordpress主题开发的新手。现在我在订购css时遇到了一些问题 我的wordpress会生成这样的头标签 <head> ... <link rel="stylesheet" type="text/css" href="http://localhost/wordpress/wp-content/themes/muarif/style.css"> ... <link rel="stylesheet" id="normalize-css"

我是wordpress主题开发的新手。现在我在订购css时遇到了一些问题

我的wordpress会生成这样的头标签

<head>
   ...
   <link rel="stylesheet" type="text/css" href="http://localhost/wordpress/wp-content/themes/muarif/style.css">
   ...
   <link rel="stylesheet" id="normalize-css" href="http://localhost/wordpress/wp-content/themes/muarif/inc/css/normalize.css?ver=4.1.1" type="text/css" media="all">
   <link rel="stylesheet" id="bootstrap-css" href="http://localhost/wordpress/wp-content/themes/muarif/inc/css/bootstrap.css?ver=4.1.1" type="text/css" media="all">
   ...
</head>
如果主题中存在Style.css,则会自动加载它。现在我想把style.css放在下面,而不是放在其他css上,把normalize.css放在上面,以便覆盖每个样式表。我使用wp_enqueue_样式并填充$deps参数。但它不会让任何事情发生


有什么建议吗?

你能试试这个代码而不是你的问题代码吗。同时搜索并删除任何其他的
wp\u enqueue\u样式
,我认为默认的一个正在加载到其他地方。还要检查它是否在
header.php中硬编码

function site_script(){
    wp_enqueue_style('normalize',get_template_directory_uri().'/inc/css/normalize.css');
    wp_enqueue_style('bootstrap',get_template_directory_uri().'/inc/css/bootstrap.css');
    wp_enqueue_style('theme_name',get_template_directory_uri().'/style.css');

    //jquery script
    wp_register_script('jquery',get_template_directory_uri().'/inc/js/jquery.js');
    wp_enqueue_script('jquery');

    //angular script
    wp_register_script('angular',get_template_directory_uri().'/inc/js/angular.js');
    wp_enqueue_script('angular');

    //bootstrap script
    wp_register_script('bootstrap',get_template_directory_uri().'/inc/js/bootstrap.min.js',array('jquery'));
    wp_enqueue_script('bootstrap');

}
add_action('wp_enqueue_scripts','site_script');
您可能还需要更新jQuery部件,如下所示:

if (!is_admin()) {
    wp_deregister_script('jquery');
    wp_register_script('jquery',get_template_directory_uri().'/inc/js/jquery.js');
    wp_enqueue_script('jquery');
}

仅供参考:

您可以分享您的wp\u排队\u样式代码吗?看起来你可以通过简单地移动它们来解决这个问题,而不是设置参数。我不认为style.css会被WordPress自动排队。必须有其他函数(或模板文件)正在加载样式表。您可以查看主题的header.php,看看它是否是硬编码的。如果我重新声明style.css,它应该是双css加载的。该style.css之前必须加载,请参阅更新的答案。
if (!is_admin()) {
    wp_deregister_script('jquery');
    wp_register_script('jquery',get_template_directory_uri().'/inc/js/jquery.js');
    wp_enqueue_script('jquery');
}