• Resolved infomatrix

    (@infomatrix)


    hi, i have my blog setting to show 5 posts in the index page. how can i put google ads only below the first two posts??? i put my adsense code in the while loop. and i am getting error page below the last 3 posts because of google limitation. so is there a way to put google ads only under the first two posts in the index?? thanks in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • Kafkaesqui

    (@kafkaesqui)

    This should work:

    <?php if( is_home() && ($post == $posts[0] || $post == $posts[1]) ) :?>
    ~ GOOGLE AD CODE HERE ~
    <?php endif; ?>
    Thread Starter infomatrix

    (@infomatrix)

    Wow….You are really Amazing…Thanks alot

    wendy

    (@aprilfranco)

    Thanks for this code: I’ve implemented it onto my site, but it doesn’t quite work the way I would like it to.

    The adverts do not appear under the first two posts of a page pulled together for a common tag. For example, if someone clicks on a word in the tag cloud to display all related posts, no GoogleAds appear under any of the items.

    Is there a workaround?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘show google ads only for the first two posts’ is closed to new replies.