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

时间:2015-04-28 14:03:58

标签: php html css wordpress

同样,同样的问题。我不知道***到底发生了什么。我用Google搜索了过去2小时的可能解决方案,并且没有取得任何成就。

我尝试做的是将HTML静态网站转换为WordPress。我一开始就陷入困境,我需要从 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' );
}

?>

以下是我在以下目录中的所有文件:

enter image description here

然后我试图检查谷歌浏览器中的元素我得到了一堆错误,说的是同样的事情:无法加载资源:服务器响应状态为404(未找到)

在我的 header.php 中,我在<?php wp_head(); ?> TAG之前呼叫</head>。在我的 index.php 文件中,我正在调用<?php get_header(); ?>

我试图将add_action( 'wp_enqueue_scripts', 'load_styles' );移到底部;

我尝试将Filezilla中的文件夹权限设置为777;

我尝试使用get_stylesheet_uri()代替get_template_directory_uri();

我不知道接下来要做什么。

1 个答案:

答案 0 :(得分:0)

你可能已经想到这一点,但看起来你错过/css/之前你的style.css

看起来应该是这样的:

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