How to add Ads/Pictures between the Posts on the Start Page and Category Page

  • Author
    Posts
  • #13242
    Marco

    Hi,
    I’d like to ad an add (i.e. adsense) between the first and second post, the second and the third, and between the third and fourth post (On the Start Page and Category Pages).

    Like This:
    First Post/Excerpt
    Ad
    Second Post/Excerpt
    Ad
    Third Post/Excerpt
    Ad
    Fourth Post/Excerpt
    NO ads anymore

    I found some Code Examples for doing something like this, i.e. this example for adding an ad between the first and second post:

    <?php
    $postcounter = 1; // set counter to 1 for ads
    if (have_posts()) : ?>
    <?php while (have_posts()) : $postcounter = $postcounter + 1;

    the_post(); ?>
    <!– do stuff –>
    <?php if(2 == $postcounter) {
    echo

    <div id=”adsbetween”>
    <– Place ad code here –>
    </div>

    ; } ?>
    <?php endwhile; ?>
    <?php endif; ?>

    It is not exactly what I’m looking for, since i want 3 and not 1 ad between the first three/four posts.

    So I have 2 Questions:

    1. Which php file do I have to modify for the Start Page and Category Pages?
    and
    2. How do I have to change the example Code, in order to have ads between the first 3 posts?

    Would be great if someone could help me out with that…

Viewing 1 post (of 1 total)

The topic ‘How to add Ads/Pictures between the Posts on the Start Page and Category Page’ is closed to new replies.