• 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

Inserting Code after

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 › Inserting Code after

This topic is: not resolved

Tagged: code

  • This topic has 1 reply, 2 voices, and was last updated 13 years ago by rfmeier.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • June 5, 2013 at 6:15 pm #44245
    gwoodard
    Member

    Good evening all. I am working on monetizing my blog & I need to add some code after the <body> tag. I am running the Balanced Child Theme on the Genesis Framework. The code I need to add is below. I would appreciate assistance on where I go to add the code.

    Thanks!

    <!-- Beacon Ads Ad Code -->
    <script type="text/javascript">
    (function(){
      var bsa = document.createElement('script');
         bsa.type = 'text/javascript';
         bsa.async = true;
         bsa.src = 'http://cdn.beaconads.com/ac/beaconads.js';
      (document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa);
    })();
    </script>
    <!-- End Beacon Ads Ad Code -->
    
    
    http://www.gregorywoodard.com
    June 5, 2013 at 6:37 pm #44246
    rfmeier
    Member

    You can hook the WordPress 'wp_footer' action and print your script there.

    add_action( 'wp_footer', 'custom_wp_footer' );
    /**
     * Callback for WordPress 'wp_footer' action.
     * 
     * Print javascript before the end of </body>
     * 
     * @package WordPress
     * @category Footer script
     * @author Ryan Meier http://www.rfmeier.net
     */
    function custom_wp_footer(){
            
            echo "<!-- Beacon Ads Ad Code -->
                    <script type='text/javascript'>
                    (function(){
                      var bsa = document.createElement('script');
                         bsa.type = 'text/javascript';
                         bsa.async = true;
                         bsa.src = 'http://cdn.beaconads.com/ac/beaconads.js';
                      (document.getElementsByTagName('head')[0]||document.getElementsByTagName('body')[0]).appendChild(bsa);
                    })();
                    </script>
                    <!-- End Beacon Ads Ad Code -->";
            
    }

    I hope this helps.


    Ryan Meier – Twitter

  • 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