2017-03-24 119 views
0

我目前正在爲Wordpress構建一個插件,但是我的樣式和腳本不會加載到視圖頁面中。Wordpress樣式表不加載

功能:

function getFrontEnd() 
{ 
    // we always need jquery 
    wp_enqueue_script('jquery'); 
    // load the core plugin scripts/styles 
    wp_enqueue_script('flex-script', __DIR__ . '/view/assets/js/wp-flex.js'); 
    wp_enqueue_style('flex-style', __DIR__ . '/view/assets/css/wp-flex.css'); 
} 

查看:

function getFlexImportView() 
{ 
    $pluginIndex = new controllers\FlexImport; 

    echo $pluginIndex->getOverview(); 
} 

而且在類FlexImport你會發現包括對執行HTML文件。

這兩種樣式文件在檢查完後都不在html文件中。

非常感謝!

+0

有沒有人可以幫助我嗎? –

回答

1

首先檢查文件路徑。使用這個:

wp_enqueue_style('flex-script',plugin_dir_url(FILE)。'view/assets/js/wp-flex.js');

+0

路徑是正確的,但孔樣式不會在插件頁面上加載,這是問題。 –