Inserting Code after

Community Forums Forums General Discussion Inserting Code after

This topic is: not resolved

Tagged: 

This topic contains 1 reply, has 2 voices, and was last updated by  rfmeier 1 year, 5 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #44245

    gwoodard
    Participant
    Post count: 14

    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
    #44246

    rfmeier
    Participant
    Post count: 603

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

    [php]
    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 –>";

    }[/php]

    I hope this helps.


Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.