2014-09-02 43 views
0

我不知道爲什麼,但我的functions.php文件不加載任何腳本/樣式。這是我的functions.php文件:Wordpress Functions.php文件不會排隊任何東西

<?php 

function promotie_load_styles() { 
    /* If this is the admin area of WordPress, don't do anything */ 
    if(is_admin()) 
     return; 

    wp_enqueue_script('latest-jquery','https://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js'); 

    wp_enqueue_style('fonts', 'http://fonts.googleapis.com/css?family=PT+Sans'); 

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

    wp_register_script('html5shiv', 'https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js'); 
    wp_enqueue_script('html5shiv'); 
    wp_register_script('respond','https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js'); 
    wp_enqueue_script('respond'); 

    // bootstrap stuff 
    wp_register_script('bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.js'); 
    wp_enqueue_script('bootstrap-js'); 

    wp_register_style('bootstrap-css', '//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css'); 
    wp_enqueue_style('bootstrap-css'); 
} 
add_action('wp_enqueue_scripts', 'promotie_load_styles'); 

這裏有什麼問題?我只是將操作添加到wp_enqueue_scripts並排入腳本/樣式,但是當我檢查頁面並轉到資源時,沒有任何內容,沒有樣式,沒有腳本。

編輯1:另一個奇怪的是,我的主題用於沒有functions.php文件,我在閱讀更多關於排隊之前加載了標題中的腳本。現在,我創建了functions.php,沒有任何東西被正確導入。我在那裏添加了一些隨機文本,並且沒有返回錯誤,並且如果我在函數外鍵入某些內容,它會在html頁面中回顯。

我的猜測是某處出現錯誤,但我不知道如何調試它,我在wp-config中將WP_DEBUG設置爲true,我不知道該怎麼做。

+0

此腳本在這裏工作。你可能會在管理員登錄 – 2014-09-02 10:08:36

+0

我刪除該行毫無疑問,仍然沒有成功,沒有得到加載。 – florinmtsc 2014-09-02 10:11:31

回答

2

您可能會丟失wp_head()裏面的<head></head>標記

+0

這是問題所在,非常感謝!你能給我一些關於如何調試的參考嗎?我不知道要調試,發現一些問題非常困難,不知道在哪裏尋找。 – florinmtsc 2014-09-02 10:53:27

+0

該法典有一篇非常有用的文章[這裏](http://codex.wordpress.org/Debugging_in_WordPress)。你遇到的問題,它會失敗,所以即使你調試,你也不會得到任何錯誤 – 2014-09-02 11:03:38

+0

非常感謝你Pieter Goosen – florinmtsc 2014-09-02 19:58:16

相關問題