Community Forums › Forums › Archived Forums › General Discussion › Enqueue error in Jessica Child Theme.
Tagged: 404, enqueue scripts, enqueue styles, jessica, page not found
- This topic has 3 replies, 3 voices, and was last updated 8 years, 9 months ago by carasmo.
-
AuthorPosts
-
February 25, 2016 at 7:16 am #179875NateMember
Hey everyone.
I'm having a bit of a pulling-my-hair-out moment:-). Good stuff!
So, I'm trying to enqueue a few scripts and styles that are in the child theme, basically, a custom.js file and a few other things (fontawesome stylesheet, new compiled stylesheets, etc.)
For all of them, I think I'm enqueueing them correctly, but if I view page source, and click on the <script> link, they come up 404-Page Not Found.
Here's what I've got in the functions.php for the child theme:
add_action( 'wp_enqueue_scripts', 'wsm_enqueue_assets' ); /** * Enqueue theme assets. */ function wsm_enqueue_assets() { wp_enqueue_style( 'jessica', get_stylesheet_uri() ); wp_style_add_data( 'jessica', 'rtl', 'replace' ); wp_enqueue_script( 'custom-js', get_stylesheet_directory() . '/js/custom.js', array() ); }
http://akgoods.finchproservices.com/ is where the dev site is hosted.
I'm working locally on VVV though. Could that have something to do with it?
Thanks for any and all help with this. So weird because I feel like I enqueue scripts and styles all the time. I'm sure I'm missing something small and just need another set of eyes. Currently, I've got the js file loading to the head, which is where jessica loads one of its js files. I know that's not the best solution, but it's what I've got for now to move forward.
Cheers,
Nate
Just getting started in this brave new Genesis world… Thanks in advance for all help:-).
February 25, 2016 at 3:55 pm #179920Victor FontModeratorWhen I view source, I can view the content of your files. They appear to be loading correctly. This is your custom.js:
(function($) { $(document).ready(function() { //alert('Ready!'); }); }(jQuery));
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?February 25, 2016 at 5:27 pm #179926NateMemberHey Victor,
Thanks for the reply. Yes, it's loading now, but I'm using the
get_header
hook, as it was not loading when I used thewp_enqueue_scripts
hook. I'd rather use thewp_enqueue_scripts
hook, as I think that's best practice.Thanks!
Nate
Just getting started in this brave new Genesis world… Thanks in advance for all help:-).
February 25, 2016 at 10:12 pm #179937carasmoParticipantThis is what I use, never had an issue.
/** ==================================================================================== * Register and Enqueue JS ==================================================================================== **/ function christina_enqueue_register_scripts() { //gist-async.min.js wp_register_script('gist-async', CHILD_URL . '/lib/js/gist-async.min.js', array('jquery'), null, true); wp_enqueue_script('gist-async'); } add_action( 'wp_enqueue_scripts', 'christina_enqueue_register_scripts' );
-
AuthorPosts
- The forum ‘General Discussion’ is closed to new topics and replies.