• 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 put an Adsense Ad after every Second post in Genesis?

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 put an Adsense Ad after every Second post in Genesis?

This topic is: resolved
  • This topic has 4 replies, 2 voices, and was last updated 11 years ago by ccstone.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • February 15, 2015 at 12:28 am #140893
    ccstone
    Participant

    I have Lifestyle Pro theme and I want to place a Google Adsense ad every Second post on Homepage, Category page, Tag page and Archive page.

    I've already installed "Genesis Simple Hooks" and "Quick Adsense" plugins which I use for Google Ad links and Adsense Ad for Single Post page respectively. But I can't find any options on those two plugins that allow me to put an ad after every 2 posts on Homepage etc..

    How do I put an Adsense Ad after every Second post?

    February 15, 2015 at 6:23 am #140902
    Brad Dalton
    Participant

    Try this http://wpsites.net/web-design/add-content-after-any-number-of-post-excerpts-in-any-type-of-archive/


    Tutorials for StudioPress Themes.

    February 15, 2015 at 12:01 pm #140940
    ccstone
    Participant

    Thanks, Brad.

    Do I put it anywhere in functions.php or at the end? I want to be careful.

    So I place this code exactly, except change the number 1 to 2? Do I leave the words "first_post" alone, even if I want it after every second post? Do this automatically create a dedicated widget that shows up in WordPress Widgets?

    /** Register New Widget */
    genesis_register_sidebar( array(
    	'id'				=> 'first-post',
    	'name'			=> __( 'Widget After First Post', 'wpsites.net' ),
    	'description'	=> __( 'Displays Your Widget Content After The First Post.', 'wpsites.net' ),
    ) );
    
    add_action( 'genesis_after_entry', 'widget_after_first_post' );
    /**
     * Brad Dalton
     * example http://wpsites.net/web-design/add-content-after-any-number-of-post-excerpts-in-any-type-of-archive/
     */
    function widget_after_first_post() {
    	global $post_count;
    
    	++$post_count;
    
    	if ( ( is_front_page() ) && 1 == $post_count ) {
    		echo '<div class="first-post">';
    		dynamic_sidebar( 'first-post' );
    		echo '</div><!-- end .first-post -->';
    	}
    
    }
    February 15, 2015 at 12:28 pm #140943
    Brad Dalton
    Participant

    You might want to respect my copyright policy first as well as the forum rules regarding copyright of other peoples work.


    Tutorials for StudioPress Themes.

    February 15, 2015 at 12:56 pm #140946
    ccstone
    Participant

    Sorry Brad, since you already posted the link, I thought we were having a conversation about what you posted. I would delete it if I could, but the edit button on my post is not there anymore. But just FTR, I was referring to info on Brad's site. http://wpsites.net/web-design/add-content-after-any-number-of-post-excerpts-in-any-type-of-archive

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