1
在wordpress中,我創建了一個子主題,並且一些模板根據child.css中的設計在子主題中進行了更改。如何在特定模板中不加載style.css
我也在兒童主題中創建了一個新模板,但我希望在前端只添加一個模板而不添加子主題的style.css。我的模板文件名是template-custom.php
。
如何做到這一點?
在wordpress中,我創建了一個子主題,並且一些模板根據child.css中的設計在子主題中進行了更改。如何在特定模板中不加載style.css
我也在兒童主題中創建了一個新模板,但我希望在前端只添加一個模板而不添加子主題的style.css。我的模板文件名是template-custom.php
。
如何做到這一點?
可以使用wp_dequeue_style的函數,在具體方案中刪除,CSS
嘗試下面的代碼,將工作:
/**
* Remove specific style sheets.
*/
function some_remove_styles() {
if (is_page_template('yourtemplate.php')) {
wp_dequeue_style('some-style');
wp_dequeue_style('some-other-style');
}
}
add_action('wp_print_styles', 'some_remove_styles', 99);