admin管理员组文章数量:1332872
Thanks in advance for the help, and apologies if I'm being dumb, I'm rather new. I have tried various different answers on this site, but they did not work, as they were meant for different pages. I am trying to have the header and main body have a different bootstrap version.
For the website, I created a navbar (in a file called header-topnav.php) with bootstrap 4.1.3 (.1.3/css/bootstrap.min.css) and the body / rest of the website was created with bootstrap 3.3.7, and when I enqueue both in functions.php, it seems that there are major conflicts with the styling of the body but the navbar is fine.
If I only link the bootstrap 4 to the header-topnav.php file, it still conflicts with the body. Trying the following after registering bootstrap4 in functions.php did not work:
<? function topnav_enqueue_style() {
wp_enqueue_style( 'bootstrap4-css');
}
add_action( 'wp_enqueue_scripts', 'topnav_enqueue_style' ); ?>
Trying a conditional in functions.php didn't work (as expected) because my custom header is not a page, persay. Just a header.
if( is_page( 'header-topnav' ) ) { // Only add this style onto the Blog page.
wp_enqueue_style( 'bootstrap4-css' );
}
How can I have bootstrap 4 applied to the header and ONLY the header? I would like this to be applied to the header of all pages, but only have the header utilize bootstrap 4 as of now. Is there some if statement I could use in the functions.php to do this? Thank you so much.
本文标签: functionsHow to reference different css (bootstrap) stylesheets for the header and body of a page
版权声明:本文标题:functions - How to reference different css (bootstrap) stylesheets for the header and body of a page? 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742342125a2456812.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论