简体   繁体   English

Wordpress 无法加载样式:加载资源失败:服务器响应状态为 404(未找到)

[英]Wordpress can't load styles: Failed to load resource: the server responded with a status of 404 (Not Found)

I'm trying to convert HTML static website to WordPress.我正在尝试将 HTML 静态网站转换为 WordPress。 I'm stuck at the very beginning, where I need to load all my styles from css folder in my function.php我一开始就被卡住了,我需要从我的function.php 中的css 文件夹加载我的所有样式

<?php 
// Loading styles

add_action( 'wp_enqueue_scripts', 'load_styles' );
function load_styles() {

    wp_enqueue_style( 'animate', get_template_directory_uri() . '/css/animate.css' );
    wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/css/font-awesome.css' );
    wp_enqueue_style( 'font-awesome2', get_template_directory_uri() . '/css/font-awesome2.css' );
    wp_enqueue_style( 'framework', get_template_directory_uri() . '/css/framework.css' );
    wp_enqueue_style( 'owl', get_template_directory_uri() . '/css/owl.theme.css' );
    wp_enqueue_style( 'style', get_template_directory_uri() . 'style.css' );
}

?>

Here are all my files located in the following directory:这是我位于以下目录中的所有文件:

在此处输入图片说明

And then I'm trying to inspect element in Google Chrome I got a bunch of errors that are saying the same thing: Failed to load resource: the server responded with a status of 404 (Not Found)然后我试图检查谷歌浏览器中的元素我得到了一堆错误,它们都在说同样的事情:加载资源失败:服务器响应状态为 404(未找到)

In my header.php I'm calling <?php wp_head(); ?>在我的header.php 中,我正在调用<?php wp_head(); ?> <?php wp_head(); ?> right before the </head> TAG. <?php wp_head(); ?>就在</head>标签之前。 In my index.php file I'm calling <?php get_header(); ?>在我的index.php文件中,我调用<?php get_header(); ?> <?php get_header(); ?>

I tried to move add_action( 'wp_enqueue_scripts', 'load_styles' );我试图移动add_action( 'wp_enqueue_scripts', 'load_styles' ); to the bottom;至底部;

I tried to set permissions for my folders in Filezilla to 777;我试图将 Filezilla 中文件夹的权限设置为 777;

I tried to use get_stylesheet_uri() instead of get_template_directory_uri() ;我尝试使用get_stylesheet_uri()而不是get_template_directory_uri()

And I don't know what I supposed to do next.而且我不知道我接下来应该做什么。

You've probably already figured this out but it looks like you missed /css/ before your style.css你可能已经想通了,但看起来你在 style.css 之前错过了/css/

It should look something like this:它应该是这样的:

wp_enqueue_style( 'style', get_template_directory_uri() . '/css/style.css' );

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 加载资源失败:服务器在 Heroku 上响应状态为 404(未找到)Laravel - Failed to load resource: the server responded with a status of 404 (Not Found) Laravel on Heroku Laravel | 加载资源失败:服务器响应状态为 404(未找到) - Laravel | Failed to load resource: the server responded with a status of 404 (Not Found) 加载资源失败:服务器响应,状态为404 Not Found - Failed to load resource: the server responded with a status of 404 Not Found 为什么Wordpress无法加载资源? 它说服务器响应状态为404(未找到) - why Wordpress failed to load the resource? It said that the server responded with a status of 404 (not Found) 出现错误说无法加载资源:服务器响应状态为404(未找到) - having an error says Failed to load resource: the server responded with a status of 404 (Not Found) 文件路径返回无法加载资源:服务器响应状态为404(未找到) - file path returning Failed to load resource: the server responded with a status of 404 (Not Found) Javascript XHR 向 php 文件发送请求:加载资源失败:服务器响应状态为 404(未找到) - Javascript XHR Post Request to php file: Failed to load resource: the server responded with a status of 404 (Not Found) 加载资源失败:服务器使用Js,ajax,php在联系表单上以404(未找到)状态进行响应 - Failed to load resource: the server responded with a status of 404 (Not Found) on contact form using Js, ajax, php 我找不到图像(无法加载资源:服务器响应状态为403(禁止)) - i can not found image ( Failed to load resource: the server responded with a status of 403 (Forbidden) ) Laravel Chained Select加载资源失败:服务器响应状态为500 - Laravel Chained Select Failed to load resource: the server responded with a status of 500
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM