I would like to have a specific divider after my posts.
I have 3 dividers -> divider1,divider2,divider3
Basicly i would like for them to loop, so after post 1 i get divider1, post 2-> divider2, post3->divider3, post 4 ->divider1 etc…
This is my code:
<div class="post">
<div class="post-title">
<h2><a href="<?php the_permalink() ?>" rel="bookmark"
title="Permanent Link to <?php the_title_attribute(); ?>">
<?php the_title(); ?>
</a></h2>
</div>
<div class="post-date">
<?php the_time('j-n-Y') ?><br/>
</div>
<div class="entry">
<?php the_excerpt();?>
</div>
<div class="meta">
<span class="post-cat"><?php the_category(',') ?></span>
<span class="post-comments"> <?php comments_popup_link('No Comments', '1 Comment', '% Comments'); ?></span>
</div>
<div class="divider1"></div>
</div>
so the class should loop from divider1 to divider2 to divider3 to divider1 and keep on looping, can anyone help me?
Make a counter and check its modulus to cycle 1 to 3 (actually we’ll use 0 to 2)
There are other ways you could do this. For example, without the switch you can set the divider class directly with the modulus: