skip to Main Content

I’m invoke the bootstrap.main.js using wp_enqueue_style in functions.php
but i show that in console and bootstrap.main.js exists and path correct.

(index):32 GET http://localhost/wordpress/wp-content/themes/abdelkhalek/css/bootstrap.main.css?ver=5.7.1 net::ERR_ABORTED 404 (Not Found)
(index):75 GET http://localhost/wordpress/wp-content/themes/abdelkhalek/js/bootstrap.main.js?ver=5.7.1 net::ERR_ABORTED 404 (Not Found)
(index):75 GET http://localhost/wordpress/wp-content/themes/abdelkhalek/js/bootstrap.main.js?ver=5.7.1 net::ERR_ABORTED 404 (Not Found)

2

Answers


  1. In my case, I removed the version from the wp_enqueue_style script :

    wp_enqueue_style( 'bootstrap-css', get_template_directory_uri() . '/css/bootstrap.min.css' , array(), null);
    wp_enqueue_style( 'bootstrap-js', get_template_directory_uri() . '/js/bootstrap.min.css' , array(), null);
    

    The last parameter null is the version, which leads to 404 Error if you set the version 5.7.1 there.

    Login or Signup to reply.
  2. your JavaScript calling system is default true which is footer area if you set it false then it add on header area. so go through as below lines.

    wp_enqueue_style( ‘bootstrap-css’, get_template_directory_uri() . ‘/css/bootstrap.min.css’ , array(), null);
    wp_enqueue_style( ‘bootstrap-js’, get_template_directory_uri() . ‘/js/bootstrap.min.css’ , array(), true);

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search