Place DIV tag at the star of every specific number of posts, is it possible?
-
Hi ..
I would like to know if it’s possible to add for example:
a
<div class="pages"></div>
every 4 post
I mean if I use this:
<?php $my_query = new WP_Query('cat=2&showposts=4p&orderby=id&order=asc'); ?> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <div> <?php the_post_thumbnail(); ?> <h1 class="other-item"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1> </div> <?php endwhile; ?>
I get this, repeated 3 more times :
<div> <a href="#" title=""><img src="#" class="attachment-post-thumbnail wp-post-image" alt="" title="" /></a> <h1 class="other-item"><a href="#">EXPAMLE</a></h1> </div>
But is possible to place a :
<div class="pages"></div>
at the first post and then place it util every 2th post, like
<div class"pages"> <div> <a href="#" title=""><img src="#" class="attachment-post-thumbnail wp-post-image" alt="" title="" /></a> <h1 class="other-item"><a href="#">EXAMPLE</a></h1> </div> <div> <a href="#" title=""><img src="#" class="attachment-post-thumbnail wp-post-image" alt="" title="" /></a> <h1 class="other-item"><a href="#">EXAMPLE</a></h1> </div> </div> <!--- End Pages --> <div class"pages"> <!--- Pages is again placed after 2 posts --> <div> <a href="#" title=""><img src="#" class="attachment-post-thumbnail wp-post-image" alt="" title="" /></a> <h1 class="other-item"><a href="#">EXAMPLE</a></h1> </div> <div> <a href="#" title=""><img src="#" class="attachment-post-thumbnail wp-post-image" alt="" title="" /></a> <h1 class="other-item"><a href="#">EXAMPLE</a></h1> </div> </div> <!--- End Second Instance Pages -->
Sorry to bother with this kind of things , but hope somebody can give a answer of this..
thanks in advance
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Place DIV tag at the star of every specific number of posts, is it possible?’ is closed to new replies.