• 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

Add bottom page script, before

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 › Add bottom page script, before

This topic is: resolved
  • This topic has 2 replies, 2 voices, and was last updated 8 years, 3 months ago by macrunner.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • March 8, 2018 at 11:56 am #217504
    macrunner
    Participant

    Hi,
    I want to add a script in the footer of a child theme and I used this function:

    
    function child_theme_footer_script() { ?>
      <script>
        ...myscript...
      </script>
    <?php }
    add_action( 'wp_footer', 'child_theme_footer_script' );
    

    Everything works perfectly, however I would like to place this script more in the bottom, just before the last </ body> tag, but I can not figure out if this is possible and how.
    I saw the graphic diagram of all the hooks of Genesis, I found that wp_footer is the last, then there is nothing left.

    Thanks for any help or suggestion

    March 8, 2018 at 12:30 pm #217505
    Victor Font
    Moderator

    Add a priority to the add_action so it executes later in the stack: https://developer.wordpress.org/reference/functions/add_action/


    Regards,

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

    March 9, 2018 at 12:37 am #217578
    macrunner
    Participant

    Hi Victor,
    very helpful the guide you have linked.
    On add_action I added priority 22 (making attempts)

    add_action( 'wp_footer', 'child_theme_footer_script', 22 );

    Now the script and more are in the position I wanted, before the </ body> tag
    Thanks so much.

  • Author
    Posts
Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Add bottom page script, before’ is closed to new 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