• 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

Where do you put the JavaScript in a Genesis theme?

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 › Design Tips and Tricks › Where do you put the JavaScript in a Genesis theme?

This topic is: resolved

Tagged: Coyier, foodie pro, javascript, jquery, slideshow

  • This topic has 2 replies, 2 voices, and was last updated 6 years, 2 months ago by dancoggins.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • November 16, 2016 at 3:32 pm #196259
    dancoggins
    Participant

    I'm using Foodie Pro. And building a slider with Chris Coyier's great advice at https://css-tricks.com/snippets/jquery/simple-auto-playing-slideshow/ .

    Where do I put the jQuery JavaScript code? I've tried putting it in Genesis > Theme Settings > Header and Footer Scripts but that hasn't worked. Here's the code:

    $("#slideshow > div:gt(0)").hide();
    
    setInterval(function() { 
      $('#slideshow > div:first')
        .fadeOut(1000)
        .next()
        .fadeIn(1000)
        .end()
        .appendTo('#slideshow');
    },  3000);

    The site advises me to run after the DOM is ready. I'm just an intermediate coder and I don't understand this.

    Thanks for your help.

    November 16, 2016 at 6:30 pm #196261
    Victor Font
    Moderator

    Your code is not complete. You need to wrap your code in the following:

    <script>
    jQuery(document).ready(function ($) {
        "use strict";
    
    });
    </script>

    Regards,

    Victor
    https://victorfont.com/
    Call us toll free: 844-VIC-FONT (842-3668)
    Have you requested your free website audit yet?

    November 16, 2016 at 9:12 pm #196262
    dancoggins
    Participant

    Thanks, Victor.

    You made my day! I put it into the head script field with your bracketing code and voilĂ ! Success, thanks to you.

    Much appreciated,

    Dan

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘Design Tips and Tricks’ 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

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