admin管理员组

文章数量:1431912

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' );

本文标签: Bootstrap isn39t called into my Wordpress theme