WordPress.org

Forums

display ad after every 4 post in index.php (3 posts)

  1. yashmistrey
    Member
    Posted 3 years ago #

    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

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    <?php if ($count==4) :
    dynamic_sidebar('index-insert');
    $count = 1;
    else $count = $count + 1;
    endif;
    endwhile; else: ?>
  3. yashmistrey
    Member
    Posted 3 years ago #

    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: ?>

Topic Closed

This topic has been closed to new replies.

About this Topic