再次,同樣的問題。我不知道這是怎麼回事。我在過去的2個小時內搜索了可能的解決方案,但沒有取得任何成果。Wordpress無法加載樣式:無法加載資源:服務器迴應狀態爲404(未找到)
我想要做的是將HTML靜態網站轉換爲WordPress。而我被困在一開始,在這裏我需要加載從css文件夾我的風格,我function.php
<?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');
}
?>
這裏有我的所有文件位於以下目錄:
然後我試圖在谷歌瀏覽器檢查元素我有一大堆被說同樣的事情的錯誤:無法加載資源:服務器與404(未找到)
狀態迴應在我的header.php我打電話<?php wp_head(); ?>
就在</head>
TAG之前。在我的index.php文件中,我打電話給<?php get_header(); ?>
我試圖將add_action('wp_enqueue_scripts', 'load_styles');
移動到底部;
我試圖將我的文件夾在Filezilla中的權限設置爲777;
我試過用get_stylesheet_uri()
代替get_template_directory_uri()
;
而我不知道接下來我會做什麼。
也許一個愚蠢的問題,但有你激活了主題? –
只需檢查瀏覽器源代碼,並檢查與CSS網址,我認爲這是不正確的。這是獲取URL並檢查源代碼的簡單方法。 –
是的,我已經在WordPress儀表板中激活了我的自定義主題。我能夠看到我的標記沒有樣式。 –