$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Adding Bootstrap to WordPress TwentySixteen Theme|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Adding Bootstrap to WordPress TwentySixteen Theme

matteradmin9PV0评论

How can I add Bootstrap to the Wordpress TwentySixteen Theme without using a plugin? I've tried linking to the stylesheets and scripts within the header/footer, however the theme seems to override something, and I'm unable to get different Bootstrap elements to work on specific pages. For instance, I've tried to get the clickable tabs to work, but no luck.

I've tried using the following code: /

While adding the CSS to the header and JS to the footer file:

<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
   <script src="/scripts/jquery.min.js"></script>
   <script src="/bootstrap/js/bootstrap.min.js"></script>

How can I add Bootstrap to the Wordpress TwentySixteen Theme without using a plugin? I've tried linking to the stylesheets and scripts within the header/footer, however the theme seems to override something, and I'm unable to get different Bootstrap elements to work on specific pages. For instance, I've tried to get the clickable tabs to work, but no luck.

I've tried using the following code: http://jsfiddle/xfw8t/12/

While adding the CSS to the header and JS to the footer file:

<link href="/bootstrap/css/bootstrap.min.css" rel="stylesheet">
   <script src="/scripts/jquery.min.js"></script>
   <script src="/bootstrap/js/bootstrap.min.js"></script>
Share Improve this question edited Apr 20, 2016 at 6:07 prosti 4,3234 gold badges26 silver badges45 bronze badges asked Apr 19, 2016 at 20:41 sargeantosargeanto 91 silver badge2 bronze badges 2
  • Why would you want bootstrap on top of TwentySixteen? Bootstrap is best suited to build stuff based on it. Introducing it to existing codebase is most likely going to break it. Consider choosing a more suitable starting theme like github/roots/sage. – Z. Zlatev Commented Apr 19, 2016 at 20:56
  • Zlatev is on the money. If it's just tabs you want, maybe look into something else rather than Bootstrap. Potentially jQuery UI tabs, but that will probably need a little bit of work to integrate it into TwentySixteen as well. Welcome to WPSE btw! – Tim Malone Commented Apr 19, 2016 at 21:11
Add a comment  | 

2 Answers 2

Reset to default 1

If you want to link stylesheets and scripts in wordpress,the correct way is to use wp_enqueue_style() and wp_enqueue_scripts() in your functions.php file

Try this in your functions.php file

wp_enqueue_style('bootstrap-css',get_template_directory_uri().'/bootstrap/css/bootstrap.min.css');
wp_enqueue_script('jquery',get_template_directory_uri().'/scripts/jquery.min.js');
wp_enqueue_script('bootstrap-js',get_template_directory_uri().'/bootstrap/js/bootstrap.min.js');

Swopnil Dangol is correct, However seeing that you are editing a standard wordpress theme in the first place with bootstrap i would not bother

the below answer is the for lazy man.

php echo get_template_directory_uri(); ?>

infront of the urls

Post a comment

comment list (0)

  1. No comments so far