WordPress.org

Ready to get started?Download WordPress

Forums

Adding code after posts in archives (3 posts)

  1. pilkster
    Member
    Posted 7 years ago #

    I would like to be able to add advertising to my blog, but I only want to show the advert on the front page and in the archives.

    I would like to place an advert after every second or third post in a similar way to how http://www.engadget.com does, not after every post.

    Also I would like to mix up the adverts, so not every one is a adsense block.

    I guess the part of the code I need to be hacking is somewhere near here:

    <?php while (have_posts()) : the_post(); ?>

    and what I need to say is something like

    if post =1 do nothing
    if post =2 do nothing
    if post =3 show adsense
    if post =4 do nothing
    if post =5 do nothing
    if post =6 show chitika
    etc etc

    Is this something easy to do? Does anyone know of a plugin that might help?

    Thanks in advance - pilks.

  2. Chris_K
    Member
    Posted 7 years ago #

    See if this article doesn't inspire some ideas.

  3. pilkster
    Member
    Posted 7 years ago #

    Awesome. Thank you so much :)

Topic Closed

This topic has been closed to new replies.

About this Topic