• 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

How to Add a Script to a Specific Page

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 › How to Add a Script to a Specific Page

This topic is: not resolved
  • This topic has 14 replies, 2 voices, and was last updated 12 years, 3 months ago by futurewebboss.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • October 1, 2013 at 7:46 pm #65030
    futurewebboss
    Member

    This is a bit of an advanced topic but I'm hoping someone can help me out. I am creating a video sales letter that I want to put on a site that is using the Lifestyle theme. I plan on using the landing page template. Now what makes this unique is that the page will have a video sales letter that I want to support with a unique script that will reveal the buy button after a given number of seconds have passed. I am sure that many of you have experienced these. The video plays and then at a specific point in the video, presto chango, the buy button magically appears. The java script should go in the head section. Now I know that Genesis Simple hooks might be integral in this but would have to identify a specific page so that the script only executes given the specific page. The other option would be to create a new page template (I guess) and then hard code the java script into the new page template. Am open to anyone who has any suggestions or who can donate any code on this.
    Thanks in advance,

    Dan

    October 1, 2013 at 8:06 pm #65034
    Brad Dalton
    Participant

    There's a script box on every page.

    Or you can conditionally load it.

    Sample code:

    https://gist.github.com/braddalton/5943226


    Tutorials for StudioPress Themes.

    October 1, 2013 at 8:48 pm #65040
    futurewebboss
    Member

    Wow! Thanks for the quick response.
    This code would go in the head portion of genesis simple hooks?

    October 1, 2013 at 10:16 pm #65047
    Brad Dalton
    Participant

    At the end of your child themes functions.php file.

    You will need to modify it slightly to suit your own needs.


    Tutorials for StudioPress Themes.

    October 2, 2013 at 4:14 pm #65122
    futurewebboss
    Member
    This reply has been marked as private.
    October 2, 2013 at 6:54 pm #65153
    Brad Dalton
    Participant

    Sorry but i cannot receive private messages.

    You can contact me using the form on my site http://wpsites.net/contact/


    Tutorials for StudioPress Themes.

    October 2, 2013 at 7:13 pm #65158
    futurewebboss
    Member

    Brad,

    Not sure I understand exactly what to do here and where to exactly place the script I have. In the example you provide there are two places where it says “your script”. Does this mean I have to put my script in both places? Sorry to be such a pain but want to get this right and do appreciate your time.

    Dan

    FYI here is my script.
    ———–Script In The Header———

    <script type=”text/javascript”>
    //hidden buy button
    function showIt() {
    document.getElementById(“hid”).style.display = “block”;
    document.getElementById(“lf”).style.display = “block”;
    }
    setTimeout(“showIt()”, 300000); // Time in Seconds x 1000
    </script>

    —————————————-

    ———–On the Page —————–

    <div align=”center” id=”hid” style=”display:none;”>

    Hidden Content Goes Here

    </div>

    —————————————-

    October 2, 2013 at 8:05 pm #65162
    Brad Dalton
    Participant

    You need to paste the script into a file in a js folder in your child theme unless its hosted already.

    Then add the script name to the code.

    Otherwise use the scripts box under all edit screens.


    Tutorials for StudioPress Themes.

    October 2, 2013 at 8:37 pm #65163
    futurewebboss
    Member

    Going way beyond my knowledge at this point.

    October 3, 2013 at 9:32 am #65206
    futurewebboss
    Member

    Brad,

    Question.......
    1. Paste the script in a file is pretty straight forward, but what would the file extension be?

    October 3, 2013 at 2:12 pm #65248
    Brad Dalton
    Participant

    If you save it as a .js file then it will be js as indicated in the code.

    /js/your-script.js

    and you can create a new folder and name it js as well.

    The name will be your-script

    Any reason you don't want to use the scripts box?


    Tutorials for StudioPress Themes.

    October 3, 2013 at 3:41 pm #65259
    futurewebboss
    Member

    Actually, now that you mention it I hadn't thought of looking for it. So we're saying that the scripts box can take this same code when I create a new page? This is obviously the best but hadn't even noticed it. I will test it.

    October 10, 2013 at 2:37 pm #66177
    futurewebboss
    Member

    Well the script in the script box did not work. Any ideas as to maybe why?

    October 10, 2013 at 3:00 pm #66178
    futurewebboss
    Member

    Actually, it kind of does work but it displays the hidden content not below the video but at the top of the page. Hm?

    October 10, 2013 at 3:12 pm #66180
    futurewebboss
    Member

    Horray!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Got it working.

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

© 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