Php style.css没有';我不在wordpress工作
我创建了三个文件:Php style.css没有';我不在wordpress工作,php,wordpress,wordpress-theming,Php,Wordpress,Wordpress Theming,我创建了三个文件:functions.php,style.css,header.php,但是header.php没有看到style.css 在functions.php中,我编写 /** * Enqueue scripts and styles. */ function newtheme_scripts() { wp_enqueue_style('newtheme-style', get_stylesheet_uri() ); } add_action( 'wp_enqueue_scr
functions.php
,style.css
,header.php
,但是header.php
没有看到style.css
在functions.php
中,我编写
/**
* Enqueue scripts and styles.
*/
function newtheme_scripts()
{
wp_enqueue_style('newtheme-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'newtheme_scripts' );
style.css
* {
background-color: black;
}
.container-fluid {
padding: 0px;
}
这里还有我的header.php
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Golden</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
<link rel="stylesheet" href="<?php echo get_stylesheet_uri() ?>">
<?php wp_head(); ?>
</head>
<body>
<div class="row header">...</div></body></html>
金质的
header.php
中调用样式表的行应该如下所示:
<link rel="stylesheet" href="<?php bloginfo( 'stylesheet_url' ); ?>">
首先,您不需要在将样式表排队后调用它,wp\u enqueue\u scripts钩子应该将您的样式表调用插入到头中的某个位置
看起来您的标题设置正确,带有wp_head();在正确的区域打电话。不过,我相信罪魁祸首在于主题本身的设置
您提到您创建了这些文件(header.php、functions.php和style.css)。。。一般来说,应该已经在主题本身中为您创建了这些文件(如果您使用的是子主题,则style.css可能除外)
希望这有帮助!祝你好运 您是否在header.php文件中使用wp_head(),可能存在重复?它应该在标签的前面。为了获得进一步的帮助,还请共享您的header.php文件,理想情况下,使用此行调用head(ex.index.php)的模板文件,您甚至不需要functions.php中的任何内容,对吗?