Reputation: 113
I am developing a custom Wordpress Theme, however once I load the project to the live server it stops enqueuing my JS files - and provides me with a 404 Error.
Additionally, I am experiencing this same issue with all of my loaded font files and CSS stylesheet
These files load correctly on my local host and only break when I load them onto the live server.
I have looked into wp_enqueue_script() and
wp_enqueue_style(), however I am still experiencing this issue.
My functions.php file includes the following script:
function custom_theme_scripts() {
wp_enqueue_style( 'custom-theme-style', get_stylesheet_uri(), array(), '20190512', 'all' );
wp_enqueue_script( 'jqueryScripts', get_template_directory_uri() . '/js/jqueryScripts.js', array ( 'jquery' ), 1.1, true);
}
add_action( 'wp_enqueue_scripts', 'sierra_ridge_scripts' );
The result of the above script is a 404 Error that appears in the debugger console.
Upvotes: 1
Views: 522
Reputation: 76
First of all you can call wrong function in add_action if you check your code you get idea.
function custom_theme_scripts() {
wp_enqueue_style( 'custom-theme-style', get_stylesheet_uri(), array(), '20190512', 'all' );
wp_enqueue_script( 'jqueryScripts', get_stylesheet_directory_uri() . '/js/jqueryScripts.js', array ( 'jquery' ), 1.1, true);
}
add_action( 'wp_enqueue_scripts', 'custom_theme_scripts' );
Please try with this code and check again.
Upvotes: 0