• 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

.js files

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 › .js files

This topic is: not resolved
  • This topic has 6 replies, 3 voices, and was last updated 12 years, 9 months ago by manavecplan.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • January 16, 2013 at 3:20 pm #12422
    manavecplan
    Member

    Hey,

    I'm a brand spanking new user of Genesis(waves to GaryJ) and I had a couple of queries on loading .js scripts

    A)Physically, which folder are .js scripts stored in under Genesis?

    B) How do you guys actually load the scripts? Is there a field I need to paste the script locations into? Or is it that enqueue_script thing in custom php?

    The questions may seem a bit simplistic but I'm coming over from Thesis and .js is handled a bit different over there.

    January 16, 2013 at 3:26 pm #12430
    SoZo
    Member

    In Genesis they are in lib=>js

    Genesis provides header and footer script boxes in its settings panel. Otherwise you can load them through functions.php using enqeue_script.


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    January 17, 2013 at 2:14 am #12580
    manavecplan
    Member

    Thanks so much John!

    Would the following be a valid example of using the enqueue script?

    <code>

    function ronald_load_scripts() {
    if ( ! is_admin() ) {
    wp_register_script( 'zoomPercent', get_template_directory_uri() . '/js/zoom.js', array( 'jquery' ) );
    wp_register_script( 'infiniteCarousel', get_template_directory_uri() . '/js/cursoule.js', array( 'jquery' ) );

    wp_enqueue_script( 'zoomPercent' );
    wp_enqueue_script( 'infiniteCarousel' );
    }
    }
    add_action( 'wp_enqueue_scripts', 'ronald_load_scripts' );</code>

    January 17, 2013 at 10:32 am #12633
    SoZo
    Member

    Yes, that's it if you don't want it loading for admins


    John “Nicolas Flamel” Wright | SoZo’s design| John Wright Photography

    January 17, 2013 at 4:00 pm #12734
    manavecplan
    Member

    Almost there, John.

    This is my current code:

    function load_scripts() {
    wp_register_script('fokus', get_template_directory_uri(). '/js/fokus.js');
    wp_enqueue_script('fokus');
    }
    add_action('wp_enqueue_scripts', 'load_scripts');

    However, it refuses to load from the js folder in my child theme. What am I doing wrong here?

    My site is: http://cityslick.in/ and the js is from https://github.com/hakimel/Fokus

    January 17, 2013 at 5:32 pm #12748
    Jen Baumann
    Participant

    You need this for a child theme: http://codex.wordpress.org/Function_Reference/get_stylesheet_directory_uri 🙂 Right now you're code is looking in the parent theme.

    January 18, 2013 at 10:25 am #12872
    manavecplan
    Member

    Thanks Jen!

    My new code is as follows:


    function load_scripts() {
    wp_register_script('fokus', get_stylesheet_directory_uri(). '/js/fokus.js');
    wp_enqueue_script('fokus');
    }
    add_action('wp_enqueue_scripts', 'load_scripts');

    I don't see where I'm going wrong...now everything seems to be correct and it's still not being loaded as per my page source. And it's apparently childishly simple according to the example by the js dev...

    Still no cigar... 🙁

  • Author
    Posts
Viewing 7 posts - 1 through 7 (of 7 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

© 2025 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