I have tried using the following code to embed Bootstrap to WordPress but it doesn’t work. Need help……….
<?php
function resources() {
wp_enqueue_style('style',get_stylesheet_uri());
wp_enqueue_style('bootstrap.min',get_template_directory_uri().'/css/bootstrap.min.css');
wp_enqueue_style('bootstrap',get_template_directory_uri().'/css/bootstrap.css');
wp_enqueue_style('bootstrap-theme.min',get_template_directory_uri().'/css/bootstrap-theme.min.css');
}
add_action('wp_enqueue_scripts', 'resources');
This may be helpful to you
WordPress is to use wp_enqueue_style and wp_enqueue_script from within functions.php. In particular, we need to create a new function that adds (or enqueues) the css style and the js script and then allow WordPress to call it at the right moment by adding a wp_enqueue_scripts action.
For Reference: click here
In order to
wp_enqueue_scripts
infunction.php
work properly,<?php wp_head(); ?>
needs to be placed before the closing</head>
and<?php wp_footer(); ?>
before closing</body>
tag in your template file.Because you didn’t post your template file, so I think this can be a reason causes your problem.
Hope this help
Just use the bootstrap CDN – https://www.bootstrapcdn.com/
In your child theme find the function theme_enqueue_styles() and add the two lines of extra code shown below.
Make sure your file location of downloaded bootstrap files. and put this code into functions.php
1.stylesheet CSS file
2.script js file