• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Trouble Enqueueing Script

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › Trouble Enqueueing Script

This topic is: resolved

Tagged: CHILD_DIR, enqueue script, Genesis 2, genesis 2.0, get_stylesheet_directory_uri()

  • This topic has 1 reply, 2 voices, and was last updated 12 years, 10 months ago by David Chu.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • August 12, 2013 at 1:37 pm #55849
    electricbrick
    Participant

    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:

    src='http://www.myclient.com/mnt/stor1-wc1-dfw1/390554/841675/www.myclient.com/web/content/wp-content/themes/clienttheme/lib/ios-fix/ios-orientationchange-fix.js'

    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.

    August 13, 2013 at 5:36 pm #56200
    David Chu
    Participant

    Hi,
    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

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2026 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble