• Resolved dokdeleon

    (@dokdeleon)


    say i have 12 posts… i wanted all my posts displayed. how do i contain every 5 posts inside a div and continue on making div#1 with posts 1-5, div#2 with posts 6-10, and div#3 with posts 11-12?

Viewing 1 replies (of 1 total)
  • Thread Starter dokdeleon

    (@dokdeleon)

    ok, don’t bother… figured it out.

    <?php $panel = 1;$countpost=1;  ?>
    
    <div class="panel" id="<?php echo $panel; ?>">
    <?php query_posts('category_name=category_name&showposts=-1'); ?>
    
    <?php while (have_posts()) : the_post();   ?>
    
    			<!-- display whatever -->
    
    <?php  if($countpost==5) {?>
    <!-- countpost = <?php echo $countpost; ?>-->
    
    </div> <!-- panel end  <?php echo $panel; $panel++; ?>-->
    
    <div class="panel" id="<?php echo $panel; ?>">
    
    <?php $countpost = 0;  ?>
    <?php } else {  ?>
    
    <!-- countpost = <?php echo $countpost; ?>-->
    
    <?php };$countpost++; endwhile;?>
    
    </div> <!-- panel end -->

    hope this can be useful to anyone

Viewing 1 replies (of 1 total)
  • The topic ‘contain every 5 posts inside div’ is closed to new replies.