1

I've tried for hours to make wp_enqueue_style running when load in head part.

this is my code

function test_script(){

//Add Bootstrap Style
wp_enqueue_style('muarif-bootstrap',get_template_directory_uri().'/inc/css/bootstrap.css');

}
add_action('wp_enqueue_scripts','test_script');

But when i running my website, it's not load properly.

Here is my generated head

<head>
     <title>Muarif Gustiar | Web Developer - User Experience - Digital Marketing</title>
     <meta charset="UTF-8">
     <meta name="description" content="">
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
     <meta http-equiv="content-type" content="text/html; charset=UTF-8">
     <style type="text/css"></style>
</head>

What wrong with my code? i follow the instruction to enqueue here. Any suggestion?

1
  • Are you sure that get_template_directory_uri().'/inc/css/bootstrap.css' points to the right place? Commented Mar 11, 2015 at 4:20

1 Answer 1

1

Give this ago

function test_script(){

wp_register_style("bootstrapcss", get_template_directory_uri() . "/inc/css/bootstrap.css");

wp_enqueue_style('bootstrapcss'); 

}

add_action('wp_enqueue_scripts','test_script');
Sign up to request clarification or add additional context in comments.

1 Comment

change get_template_directory_uri() with get_stylesheet_directory_uri() and u should be good

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.