Trouble Enqueueing Script

Community Forums Forums General Discussion Trouble Enqueueing Script

This topic is: resolved

This topic contains 1 reply, has 2 voices, and was last updated by  David Chu 2 years, 3 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
  • #55849


    I’m using the following snippet in functions.php to call a JS file:

    /** iOS Orientation Fix */
    add_action('genesis_footer', 'genesis_ios_fix');
    function genesis_ios_fix() {
            wp_register_script( 'iosfix',  CHILD_DIR . '/lib/ios-fix/ios-orientationchange-fix.js' );
            wp_enqueue_script ( 'iosfix');

    Upon upgrading to Genesis 2.0, the path shown in the rendered HTML now looks like this:


    It appears that WordPress and/or Genesis is detecting the absolute path on my server as well as the child theme directory. Did something change in 2.0 that requires me to enqueue scripts differently? I’ve tried modifying the call using get_stylesheet_directory_uri() instead of CHILD_DIR, and the path is still incorrect (identical to the path shown above).

    Note: I cannot provide a link to the site as it is protected per an NDA.


    David Chu

    I’m psychic, so I can see your site anyway. That’s a funny NDA. :-)

    Anyway, I think what you want there is “CHILD_URL” rather that DIR. DIR gives you the great big path, and AFAIK it has done that since early Genesis, so I’m intrigued that it would have worked before.

    Cheers, Dave

    Dave Chu ยท Custom WordPress Developer – likes collaborating with Designers

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.