最新消息: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)

Bootstrap isn't called into my Wordpress theme

matteradmin4PV0评论

I keep getting an error when I look into my page resource about my bootstrap.min.css file, which gives me a "Failed to load resource: the server responded with a status of 404 (Not Found)" => /wp-content/themes/test-theme/bootstrap/css/bootstrap.min.css.map

However, bootstrap does show in the browser so it should be fine, right? I am quite new to this and I don't understand why I get this error, yet my theme shows the bootstrap just fine.

I have this code:

function theme_add_bootstrap() {
wp_enqueue_style( 'bootstrap-css', get_template_directory_uri() . '/bootstrap/css/bootstrap.min.css' );
wp_enqueue_style( 'style-css', get_template_directory_uri() . '/style.css' );
wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . 'bootstrap/js/bootstrap.min.js', array(), '3.0.0', true );
}

add_action( 'wp_enqueue_scripts', 'theme_add_bootstrap' );

within my test-theme folder I have a folder named "bootstrap" in which I have my bootstraps CSS and JS files.

I keep getting an error when I look into my page resource about my bootstrap.min.css file, which gives me a "Failed to load resource: the server responded with a status of 404 (Not Found)" => http://theasianbean.local/wp-content/themes/test-theme/bootstrap/css/bootstrap.min.css.map

However, bootstrap does show in the browser so it should be fine, right? I am quite new to this and I don't understand why I get this error, yet my theme shows the bootstrap just fine.

I have this code:

function theme_add_bootstrap() {
wp_enqueue_style( 'bootstrap-css', get_template_directory_uri() . '/bootstrap/css/bootstrap.min.css' );
wp_enqueue_style( 'style-css', get_template_directory_uri() . '/style.css' );
wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . 'bootstrap/js/bootstrap.min.js', array(), '3.0.0', true );
}

add_action( 'wp_enqueue_scripts', 'theme_add_bootstrap' );

within my test-theme folder I have a folder named "bootstrap" in which I have my bootstraps CSS and JS files.

Share Improve this question edited Apr 14, 2019 at 3:53 fuxia 107k39 gold badges255 silver badges459 bronze badges asked Apr 13, 2019 at 11:28 theasianbeantheasianbean 93 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Put this code in functions.php file and check it.

function theme_add_bootstrap() {
wp_enqueue_style( 'bootstrap-css', get_template_directory_uri() . '/bootstrap/css/bootstrap.min.css' );
wp_enqueue_style( 'style-css', get_template_directory_uri() . '/style.css' );
wp_enqueue_script( 'bootstrap-js', get_template_directory_uri() . '/bootstrap/js/bootstrap.min.js', array( 'jquery' ), '3.0.0', true );
}
add_action( 'wp_enqueue_scripts', 'theme_add_bootstrap' );
Post a comment

comment list (0)

  1. No comments so far