• 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 code to end of every post

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 code to end of every post

This topic is: not resolved

Tagged: adsense, code, Simple Hooks

  • This topic has 5 replies, 3 voices, and was last updated 12 years, 11 months ago by Pinky.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • March 15, 2013 at 1:00 pm #27200
    peps2004
    Participant

    I'm wanting to automatically add AdSense code to the end of each post in the future without having to manually add it to each post.

    I've tried a few of the simple hook options that I thought might work, but they didn't place it in the correct place. I want it to display within the post content above the category and tag listings for that post - is one of the hooks set up for that?

    The site is http://scavenger-hunt.org/ if that helps.

    March 15, 2013 at 11:02 pm #27336
    Pinky
    Member

    I've just done a quick search for a plugin to do that, and there seem to be a few...

    Take a look at this G search:

    https://www.google.com.au/search?q=plugin+add+content+toend+of+post

    OR

    You could use the code similar to adding a signature image to the end of posts

    
    // Add Signature Image after posts
    add_action('genesis_after_post_content', 'custom_include_signature', 1);
    function custom_include_signature() {
     { ?>
     <img src="http://yoursite.com/yourimage.png" alt="your image name here" />
    <?php }}
    
    

     

    I also find this page is really valuable and has helped me work things out : http://genesistutorials.com/visual-hook-guide/

     

    Hopefully that helps a little


    cheers

    Pinky

    March 15, 2013 at 11:04 pm #27341
    Brad Dalton
    Participant

    Install the Genesis Simple Hooks plugin and paste in your Adsense code in any genesis_hook location.

    <?php if (is_single() ) { ?>
    <p>Adsense-Code-Goes-Here</p>
    <?php } ?>
    

    Change the conditional tag if needed.

    Or you can use a custom function:

    add_action('genesis_after_post_content', 'adsense_after_posts');
    function adsense_after_posts() {
    if (is_single() )
        echo '<div class="adsense-style">Adsense goes here</div>';
    }	
    

    Tutorials for StudioPress Themes.

    March 15, 2013 at 11:29 pm #27360
    peps2004
    Participant

    Hi guys,

    Thanks for that - I hadn't seen that visual hooks guide before. I tried out the genesis_post_content and that seems to be just what I need. I'd assumed by the title that it would place the code at the beginning of the post but it adds it to the end of the post.

    March 15, 2013 at 11:43 pm #27363
    Brad Dalton
    Participant

    You may need to reposition the post meta if you want your ads displayed before those links.


    Tutorials for StudioPress Themes.

    March 16, 2013 at 7:27 am #27715
    Pinky
    Member

    Glad it was helpful - I have that page and a few others in my bookmarks tab for quick reference


    cheers

    Pinky

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