2016-06-28 14 views

答えて

4

はこれではJavaScript .jsファイルを追加するCSSファイルを追加するwp_enqueue_styleを追加する方法とwp_enqueue_scriptであるあなたのプラグインファイル

function add_scripts_and_css(){ 
    wp_enqueue_style('your-plugin-bootrtrap_css', plugin_dir_url(__FILE__) . 'folderpath/bootstrap.css'); 
} 

add_action('wp_enqueue_scripts', 'add_scripts_and_css'); 

で関数を作成します。

+0

あなたのコードで '' 'が見つかりませんでした。それは 'です。 'folderpath/bootstrap.css'); '代わりに...あなたの答えを更新してください。 – LoicTheAztec

+0

私の誤りを私に通知していただきありがとうございます私は自分のコードを編集しました。 –

+0

@Dharit Soni ...偉大な答え...それは私のロットの時間を節約する.. –

1
// load your plugin css into the website's front-end 
function myplugin_enqueue_style() { 
    wp_enqueue_style('myplugin-style', plugin_dir_url(__FILE__)."css/bootstrap.css"); 
} 
add_action('wp_enqueue_scripts', 'myplugin_enqueue_style'); 

上記のコードをプラグインregister_activation_hookに追加してください。

関連する問題