Parent Theme JS Issue – 404 File Not Found
-
I recently built a site using the Mk theme. I’ve been editing it quite a bit and ultimately decided that I needed to create a child theme. I’ve never done that before, so I looked up and followed instructions – created a style.css file and a functions.php file. I moved my custom styles from my custom css plugin to the new stylesheet, enqueued my parent theme’s css in the functions.php. That’s all working fine.
However, I’m getting a load of 404 File Not Found errors for my parent theme’s JS. No instructions said anything about enqueuing the parent theme’s JS. I looked around and, for the most part, all I found were topics about adding your own custom JS. I’m not adding custom JS, I just want the existing JS to load properly. I found one topic suggesting to include the enqueueing for the JS anyway and another suggesting just copying the JS files to the child theme (which seems like it defeats the purpose of a child theme). I tried both and it didn’t work.
Do I have to copy the JS files? Do I have to enqueue the JS from the parent theme? If so, is there just something wrong with my enqueue scripts below? I appreciate any help!
Here is my current functions.php text.
<?php add_action( 'wp_enqueue_scripts', 'enqueue_child_theme_styles', PHP_INT_MAX); function enqueue_child_theme_styles() { wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css' ); wp_enqueue_style( 'editor-style', get_template_directory_uri() . '/editor-style.css' ); wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.css' ); wp_enqueue_style( 'jquery', get_template_directory_uri() . '/css/jquery.mCustomScrollbar.min.css' ); wp_enqueue_style( 'mk', get_template_directory_uri() . '/css/mk.css' ); wp_enqueue_style( 'mk-fontawesome', get_template_directory_uri() . '/fonts/font-awesome/css/font-awesome.css' ); wp_enqueue_style( 'mk-zocial', get_template_directory_uri() . '/fonts/zocial/zocial.css' ); wp_enqueue_style( 'mk-pixons', get_template_directory_uri() . '/fonts/pixons/pixons.css' ); wp_enqueue_style( 'custom-style', get_template_directory_uri() . '/css/custom-style.css' ); wp_enqueue_style( 'content-sidebar', get_template_directory_uri() . '/layouts/content-sidebar.css' ); wp_enqueue_style( 'mk', get_template_directory_uri() . '/layouts/sidebar-content.css' ); wp_enqueue_style( 'child-style', get_stylesheet_uri(), array('parent-style') ); wp_enqueue_script( 'mk-superslides', get_template_directory_uri() .'/js/jquery.superslides.js',array('jquery'), $theme_name, null, true ); wp_enqueue_script( 'mk-home-slider-init', get_template_directory_uri() . '/js/mk-home-slider-init.js', array( 'jquery' ), '1.0',true ); wp_enqueue_script( 'mk-metisMenu', get_template_directory_uri() .'/js/metisMenu.js',array('jquery'), $theme_name, null, true ); wp_enqueue_script( 'mk-bootstrap-js', get_template_directory_uri() .'/js/bootstrap.js',array('jquery'), $theme_name, null, true ); wp_enqueue_script( 'mk-cycle-js', get_template_directory_uri() .'/js/jquery.cycle2.js',array('jquery'), $theme_name, null, true ); wp_enqueue_script( 'mk-init', get_template_directory_uri() .'/js/mk-init.js', false,array('jquery'),$theme_name, null, true ); wp_enqueue_script( 'mk-navigation', get_template_directory_uri() . '/js/navigation.js', array(), $theme_name, true ); wp_enqueue_script( 'mk-custom-scrollbars', get_template_directory_uri() . '/js/jquery.mCustomScrollbar.concat.min.js', array(), $theme_name, true ); wp_enqueue_script( 'mk-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js',array('jquery'), $theme_name, true ); }
Here is a copy of the error messages though I linked to the site at the top:
GET http://poetic-logic.com/wp-content/themes/mk/css/custom-style.css?189db0 404 (Not Found)
jquery-migrate.min.js?189db0:2 JQMIGRATE: Migrate is installed, version 1.4.0
(index):183 GET http://poetic-logic.com/wp-content/themes/mk/js/navigation.js%20Child-1.0.0?189db0
(index):183 GET http://poetic-logic.com/wp-content/themes/mk/js/jquery.cycle2.js%20Child-1.0.0?189db0
(index):183 GET http://poetic-logic.com/wp-content/themes/mk/js/jquery.superslides.js%20Child-1.0.0?189db0
(index):183 GET http://poetic-logic.com/wp-content/themes/mk/js/metisMenu.js%20Child-1.0.0?189db0
(index):183 GET http://poetic-logic.com/wp-content/themes/mk/js/bootstrap.js%20Child-1.0.0?189db0 404 (Not Found)
(index):183 GET http://poetic-logic.com/wp-content/themes/mk/js/skip-link-focus-fix.js%20Child-1.0.0?189db0
(index):183 GET http://poetic-logic.com/wp-content/themes/mk/js/jquery.mCustomScrollbar.concat.min.js%20Child-1.0.0?189db0 404 (Not Found)
mk-home-slider-init.js?189db0:3 Uncaught TypeError: jQuery(…).superslides is not a function(anonymous function) @ mk-home-slider-init.js?189db0:3i @ jquery.js?189db0:2j.fireWith @ jquery.js?189db0:2n.extend.ready @ jquery.js?189db0:2K @ jquery.js?189db0:2
mk-init.js?ver[0]=jquery&189db0:40 Uncaught TypeError: $(…).mCustomScrollbar is not a function(anonymous function) @ mk-init.js?ver[0]=jquery&189db0:40n.event.dispatch @ jquery.js?189db0:3r.handle @ jquery.js?189db0:3
- The topic ‘Parent Theme JS Issue – 404 File Not Found’ is closed to new replies.