Using Showposts offset with Specific Post Format
-
I’m building a site that shows featured images from the blog in different sizes on the home page. I have that working fine using the code below. What I now want to do is limit the posts on the home page to one specific category.
I’ve found some examples, but none are working for me. Any help is appreciated. Thanks.
<!-- FIRST LOOP: display posts 1 thru 2 --> <?php query_posts('showposts=2'); ?> <?php $posts = get_posts('numberposts=2&offset=0'); foreach ($posts as $post) : start_wp(); ?> <?php static $count1 = 0; if ($count1 == "2") { break; } else { ?> <a href="<?php the_permalink() ?>"> <div class="smallbox"> <?php the_post_thumbnail( 'newwork-small' ); ?> </div></a> <?php $count1++; } ?> <?php endforeach; ?> <!-- SECOND LOOP: display post 3 --> <?php query_posts('showposts=1'); ?> <?php $posts = get_posts('numberposts=1&offset=2'); foreach ($posts as $post) : start_wp(); ?> <?php static $count2 = 0; if ($count2 == "1") { break; } else { ?> <a href="<?php the_permalink() ?>"> <div class="medbox"> <?php the_post_thumbnail( 'newwork-med' ); ?> </div></a> <?php $count2++; } ?> <?php endforeach; ?>
- The topic ‘Using Showposts offset with Specific Post Format’ is closed to new replies.