wp_enqueue_style not loading CSS
wordpress
Solution
Your action and function looks fine from here. The wp_enqueue_scripts hook should work perfectly for both stylesheets and scripts.
Have you tried echoing something out in the function to see if it's actually being called at all? I.e:
function load_scripts() {
echo "Does this output to the actual page?";
wp_enqueue_style('bootstrap.css', get_template_directory_uri() . '/css/bootstrap.min.css');
}
add_action('wp_enqueue_scripts', 'load_scripts');
If it's not, you might have a problem with your placement of the code, but if you keep everything in functions.php and outside of any other scope this shouldn't be a problem. Another thing that can cause this behaviour is if you have already registered a stylesheet or script with the same handle ("bootstrap.css" in this case). The first argument in the wp_enqueue_style() function is just a handle for internal dependency management and should be unique, try renaming it to something else and see if that fixes your problem.
Problem
I am attempting to load a script using `wp_enqueue_style` following the advice on the Wordpres Codex, but the script doesn't seem to be included in the source. Is this the correct way to do it? ``` function load_scripts() { wp_enqueue_style('bootstrap.css', get_template_directory_uri() . '/css/bootstrap.min.css'); } add_action('wp_enqueue_scripts', 'load_scripts'); ```