2016-02-25 106 views
1

我正在使用一個兒童主題,並需要排列滑塊的樣式表。 CSS文件位於父主題的目錄文件夾中,即/parent-theme/css/flexislider.css如何在Wordpress子主題中排隊第二個樣式表?

我使用它增加了一個functions.php文件的子主題目錄下面的代碼插件創建的子主題:

<?php 
add_action('wp_enqueue_scripts', 'theme_enqueue_styles'); 
function theme_enqueue_styles() { 
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css'); 
wp_enqueue_style('child-style',get_stylesheet_directory_uri() . '/style.css',array('parent-style') 
); 
} 

我想我必須添加另一個條目參考flexislider.css上面的函數,但我不太確定如何去做。

回答

1

*更新

根據您加入的問題是什麼,你應該能夠只需添加到該功能並註冊的樣式表。完整的功能應該是這樣的:

add_action('wp_enqueue_scripts', 'theme_enqueue_styles'); 
function theme_enqueue_styles() { 
wp_enqueue_style('parent-style', get_template_directory_uri() . '/style.css'); 
wp_enqueue_style('child-style',get_stylesheet_directory_uri() . '/style.css',array('parent-style') 
); 
wp_enqueue_style('flex-slider',get_template_directory_uri() . '/css/flexislider.css'); 
} 

我沒有與兒童題材太多的經驗,但在該函數的模型之後,我覺得get_template_directory指向父主題,而不是子主題,你說flexislider代碼位於

+0

嗨,謝謝你的答案。我仍然不確定如何做到這一點。我只是用一些更詳細的信息更新了我的問題,這可能會幫助你更具體地回答你的答案。 – jrcollins

+0

我更新了答案,以納入您更新的問題 – CreMedian

+0

謝謝,我認爲這也可以,但事實並非如此。你說,「...並註冊樣式表」。我是否也需要註冊樣式表?這是單獨完成的嗎? – jrcollins

相關問題