• 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 Adsense beneath blog post title

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 Adsense beneath blog post title

This topic is: resolved

Tagged: adsense

  • This topic has 10 replies, 4 voices, and was last updated 13 years, 7 months ago by raunekk.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • January 4, 2013 at 11:25 am #9515
    fskhan619
    Member

    How to add Adsense beneath blog post title? I'm using Focus Child theme.

    January 4, 2013 at 12:11 pm #9538
    AnitaC
    Keymaster

    Install Genesis Simple Hooks - http://wordpress.org/extend/plugins/genesis-simple-hooks/ and then activate it.

    Look for the box that says - genesis_after_post_title

    Paste your code in there and save it.


    Need help with customization or troubleshooting? Reach out to me.

    January 4, 2013 at 12:24 pm #9541
    buddy_boy8403
    Participant

    I did this for a client.  What I did was create a new sidebar area (Nick The Geek has a good tutorial on how to do this on his website).  You need to reference the appropriate genesis hook in the sidebar code - StudioPress has a hook reference to help you out with this.

    You can try this and see if this is what you need.  Just add the code to your child theme's functions.php file and the styling to your child theme's style.css file:

    /** Start Add Sidebar After Content */
    // First we have to register the new sidebar
    genesis_register_sidebar( array(
    'id' => 'after-content-ad',
    'name' => 'Bottom Of Page Ad Area',
    'description' => 'This is a sidebar that goes after the content.',
    ) );
    // Next we have to display the sidebar
    add_action( 'genesis_after_content_sidebar_wrap', 'child_after_content_ad_sidebar' );
    /** Loads a new sidebar after the content */
    function child_after_content_ad_sidebar() {
    // Now we add the conditional to show this everywhere except the home page by putting an ! in front of is_home()
    // For more info about conditional tags, see: http://designsbynickthegeek.com/tutorials/conditional-page-content
    if (is_single() ) {
    echo '';
    dynamic_sidebar( 'after-content-ad' );
    echo '';
    }
    }
    // Finally we need to style the sidebar in the child theme's style.css file
    /** End Add Sidebar After Content */

    Now for the CSS styling

    /* Ad Sidebar
    ------------------------------------------------------------ */
    .after-content-ad {
    clear: both;
    margin: 0 auto;
    width: 728px;
    }

    January 4, 2013 at 12:25 pm #9542
    AnitaC
    Keymaster

    I think the code you pasted broke.


    Need help with customization or troubleshooting? Reach out to me.

    January 4, 2013 at 12:27 pm #9544
    buddy_boy8403
    Participant

    I think the code you pasted broke.

    I fixed it - thanks.

    January 4, 2013 at 2:32 pm #9560
    fskhan619
    Member

    Thanks both of you ..! Genesis Simple Hooks works best but I wan't the ad to appear on the post page only, not on the homepage. Can you show me how can I do that?

    January 4, 2013 at 3:13 pm #9571
    buddy_boy8403
    Participant

    @fskhan619 - The code I gave to modify your functions.php file does this.  Thats what the following conditional does in that snippet:

    if (is_single() )

    Just copy/paste that to the bottom of your functions.php file, update the styling in your style.css file and modify the styling to suite your needs.

    Once you create the new widget area, just go to your Appearance > Widgets page, drag a text widget in there and paste the adsense code. After that, you should be good to go.

    January 4, 2013 at 6:09 pm #9613
    AnitaC
    Keymaster

    @fskhan619 - here is the code you need. I hope the code posts.
    <?php if(is_single()) { ?>
    <center>
    ***Paste AdSense Code Here***
    </center>
    <?php } ?>


    Need help with customization or troubleshooting? Reach out to me.

    January 5, 2013 at 5:12 am #9708
    fskhan619
    Member

    @buddy_boy8403

    It works perfectly and thanks a lot for replying and helping!  But the widget lets you add content at the bottom of the page beneath the content and I want to add adsense (large rec) beneath the Post Titles.

    January 5, 2013 at 9:13 am #9720
    buddy_boy8403
    Participant

    Then try adding this to your functions.php file.  Don't remove the one you just put in there from your functions.php file in case later on down the road you wanted to use it.  Just don't drag any widgets to that sidebar:

    /** Start Add Sidebar Before Post */
    // First we have to register the new sidebar
    genesis_register_sidebar( array(
    'id' => 'before-posts-sidebar',
    'name' => 'Before Posts Ad Area',
    'description' => 'This is a sidebar that goes before the post content.',
    ) );
    // Next we have to display the sidebar
    add_action( 'genesis_before_post_content', 'child_before_posts_sidebar' );
    /** Loads a new sidebar before the posts in the #content */
    function child_before_posts_sidebar() {
    // Now we add the conditional to show this everywhere except the home page by putting an ! in front of is_home()
    // For more info about conditional tags, see: http://designsbynickthegeek.com/tutorials/conditional-page-content
    if (is_single() ) {
    echo '
    ';
    dynamic_sidebar( 'before-posts-sidebar' );
    echo '
    ';
    }
    }
    // Finally we need to style the sidebar in the child theme's style.css file
    /** End Add Sidebar Before Post */

    January 5, 2013 at 10:16 am #9728
    raunekk
    Participant

    Use "quick adsense" plugin. It's quite helpful with a lot of features.

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