• 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

Add AdSense in Home After Second & Third Posts

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 › Add AdSense in Home After Second & Third Posts

This topic is: not resolved

Tagged: 2.0.0, ad, adsense, css, php

  • This topic has 6 replies, 5 voices, and was last updated 11 years, 10 months ago by Genesis Developer.
Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • August 8, 2013 at 7:07 pm #55150
    Pseric
    Member

    Hi,

    I tried to using Genesis Simple Hooks and put the code:

    <?php global $loop_counter;
    if (is_home() && $loop_counter = 2) { ?>
    [AdSense]
    <?php } ?>

    It's works on 1.9.x, after I upgraded to 2.0.0, it does not works,
    how can I put the AdSense after second or third posts in homepage?

    Thanks!

    http://www.freegroup.org/
    August 9, 2013 at 6:02 am #55198
    AnitaC
    Keymaster

    Read this and it may help you - http://www.nathanrice.net/blog/genesis-loop-hooks/. 2.0 with HTML5 active will use different hooks.


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

    August 9, 2013 at 6:13 am #55202
    Brad Dalton
    Participant

    You will need to update to the latest version of the simple hooks plugin if you have converted your child theme to support HTML 5

    Here's the update (changelog) for the Genesis Simple Hooks plugin compeleted yesterday.

    2.0.0 Updated to use new entry hooks in Genesis 2.0.

    You could also put that code in to a custom function in your child themes files rather than simple hooks.


    Tutorials for StudioPress Themes.

    August 10, 2013 at 8:46 am #55459
    Pseric
    Member

    Thanks to anitac & Brad,

    I have tried this code:

    add_action( 'genesis_after_entry', 'ad_after_first_post');
    function ad_after_first_post() {
    global $loop_counter;
    if (!is_singular() && $loop_counter == 0) { ?>
    [AdSense]
    <?php }}

    I just want Ads appear after the first post, but it is displayed in every post.

    Please help, thanks!

    January 18, 2014 at 8:27 pm #85824
    Manuel
    Member

    Hi Pseric and Brandondalton, do you find the solution for this problem?, i have the same issue, it display in every post

    Thanks!

    January 19, 2014 at 1:40 am #85853
    Pseric
    Member

    Hi Manuel,

    Maybe you can try "Google Publisher Plugin", it can help you place the AdSense to the right place.

    Google Publisher Plugin
    http://wordpress.org/plugins/google-publisher/

    Regards,
    Pseric

    January 19, 2014 at 6:40 am #85858
    Genesis Developer
    Member

    see the code here http://pwdtechnology.com/adding-adsense-home-second-third-posts/


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

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

© 2025 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