/ Published in: PHP
Multiple loops advanved example
Expand |
Embed | Plain Text
// FIRST LOOP: display posts 1 thru 5 <?php query_posts('showposts=5'); ?> <?php $posts = get_posts('numberposts=5&offset=0'); foreach ($posts as $post) : start_wp(); ?> <?php the_title(); ?> <?php the_content(); ?> <?php $count1++; } ?> <?php endforeach; ?> // SECOND LOOP: display posts 6 thru 10 <?php query_posts('showposts=5'); ?> <?php $posts = get_posts('numberposts=5&offset=5'); foreach ($posts as $post) : start_wp(); ?> <?php the_title(); ?> <?php the_content(); ?> <?php $count2++; } ?> <?php endforeach; ?> // THIRD LOOP: display posts 11 thru 15 <?php query_posts('showposts=5'); ?> <?php $posts = get_posts('numberposts=5&offset=10'); foreach ($posts as $post) : start_wp(); ?> <?php the_title(); ?> <?php the_content(); ?> <?php $count3++; } ?> <?php endforeach; ?>
You need to login to post a comment.
