在过去的几个月里,我创建了一个站点,现在我应该将其上传到WordPress服务器。
在我自己的服务器上,没有WordPress,只有PHP和ApacheWordPress2,一切都很好。PHP include包含从根请求的CSS内容作为style.css。
我所有的CSS都加载到了<?php include 'include/head.php';?>中。
head.php文件的一部分:
<link rel="stylesheet" href="css/bootstrap.min.css"/>
<link rel="stylesheet" href="css/normalize.min.css"/>
<link rel="stylesheet" type="text/css" href="js/vendor/slick/slick.css"/>1
但当我把网站上传到project/wp-content/themes/project时。突然之间,任何资源都不会加载。
/js文件夹中的JavaScript脚本、/img中的图像和/css文件夹中的额外CSS,甚至根目录中的style.css都不会加载。在检查员网络选项卡上只有404。
我已经按照WordPress的要求在style.css中包含了头部分,但是我还需要做更多的事情吗?
Inspector选项卡似乎表明它正在尝试从正确的路径加载,但它仍然给出了404。
我的文件夹结构如下:
wp内部-内容/主题/项目
pages.php(20 of them, also index.php)
style.css - basic css for site layout
css/ *more css files*
img/ *image files*
include/ *PHP includes*
js/ *js action for site*主题/项目权限的八进制为: 2755
我希望这篇文章有任何意义。
发布于 2017-07-06 23:31:04
你应该像这样在你的function.php中排列你的风格:
<?php add_action('wp_enqueue_scripts', array($this, 'enqueue_styles'));}
public function enqueue_styles() {
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css'); false);
}?>https://stackoverflow.com/questions/44946858
复制相似问题