WordPress.org

Support

Support » How-To and Troubleshooting » display ad after every 4 post in index.php

display ad after every 4 post in index.php

  • how do i crate ad space after every 4 posts on index.php (home page)
    here is the code i am using

    <?php if ($count==4) { ?>
    <?php dynamic_sidebar('index-insert') ?>
    <?php } ?>
    <?php $count = $count + 1; ?>
    <?php endwhile; else: ?>

    it display ad after 4th post,

    i want to display ad after every 4 post

    thanks in advance

Viewing 2 replies - 1 through 2 (of 2 total)
  • esmi

    @esmi

    Forum Moderator

    <?php if ($count==4) :
    dynamic_sidebar('index-insert');
    $count = 1;
    else $count = $count + 1;
    endif;
    endwhile; else: ?>

    thanks esmi ! sorry for trouble thats not working
    i am using this code.. how to edit this

    <?php if ($count==3) { ?>
     <div class="clear"> </div>
    < --- ad space --- >
    		<div class="clear"> </div>
    <?php } ?>
    <?php $count = $count + 0; ?>
    <?php endwhile; else: ?>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘display ad after every 4 post in index.php’ is closed to new replies.
Skip to toolbar