Title: Sticky posts in query_posts
Last modified: August 20, 2016

---

# Sticky posts in query_posts

 *  [z1webb](https://wordpress.org/support/users/z1webb/)
 * (@z1webb)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/sticky-posts-in-query_posts/)
 * I’m having an issue. On the home page of my site, I use 4 query_post calls as
   I want an individual post to show up in each separate div. Example:
 *     ```
       <div class="colwide">
   
       <?php query_posts('showposts=1'); ?>
       <?php $posts = get_posts('numberposts=1&offset=0'); foreach ($posts as $post) : start_wp(); ?>
       <?php static $count1 = 0; if ($count1 == "1") { break; } else { ?>
   
       <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
       <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?><div class="entry">
       <?php the_content( '<span class="moretext">Continue Reading...</span>' ); ?>
   
       <?php $count1++; } ?>
       <?php endforeach; ?>
       </div>
       </div><!--End colwide-->
   
       </div><!--End mainposts-->
   
       <div id="recentposts" class="group">
       <div class="col1">
   
       <?php query_posts('showposts=1'); ?>
       <?php $posts = get_posts('numberposts=1&offset=1'); foreach ($posts as $post) : start_wp(); ?>
       <?php static $count2 = 0; if ($count2 == "1") { break; } else { ?>
   
       <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
       <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
       <?php the_excerpt(); ?>
   
       <?php $count2++; } ?>
       <?php endforeach; ?>
       </div><!--End Col1-->
   
       <div class="col2">
   
       <?php query_posts('showposts=1'); ?>
       <?php $posts = get_posts('numberposts=1&offset=2'); foreach ($posts as $post) : start_wp(); ?>
       <?php static $count3 = 0; if ($count3 == "1") { break; } else { ?>
   
       <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
       <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
       <?php the_excerpt(); ?>
   
       <?php $count3++; } ?>
       <?php endforeach; ?>
       </div><!--End Col2-->
   
       <div class="col3">
       <?php query_posts('showposts=1'); ?>
       <?php $posts = get_posts('numberposts=1&offset=3'); foreach ($posts as $post) : start_wp(); ?>
       <?php static $count4 = 0; if ($count4 == "1") { break; } else { ?>
   
       <h2><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
       <?php include (TEMPLATEPATH . '/inc/meta.php' ); ?>
       <?php the_excerpt(); ?>
   
       <?php $count4++; } ?>
       <?php endforeach; ?>
       </div><!--End Col3-->			
   
       </div><!--End Recentposts-->
       ```
   
 * I know that’s a lot. In the first Query, I want just 1 sticky post to show up,
   OR the most recent post for a the category “Main.” It doesn’t matter which. Anyone
   have any thoughts on how to get only one post from the “main” category to work?
   Thanks in advance.

Viewing 1 replies (of 1 total)

 *  Thread Starter [z1webb](https://wordpress.org/support/users/z1webb/)
 * (@z1webb)
 * [14 years, 5 months ago](https://wordpress.org/support/topic/sticky-posts-in-query_posts/#post-2444590)
 * In case my code isn’t easy to decipher, I used this example to put the posts 
   in multiple columns: [http://perishablepress.com/press/2008/09/01/multiple-loops-and-multiple-columns-with-wordpress/](http://perishablepress.com/press/2008/09/01/multiple-loops-and-multiple-columns-with-wordpress/)

Viewing 1 replies (of 1 total)

The topic ‘Sticky posts in query_posts’ is closed to new replies.

## Tags

 * [category](https://wordpress.org/support/topic-tag/category/)
 * [loop](https://wordpress.org/support/topic-tag/loop/)
 * [query_posts](https://wordpress.org/support/topic-tag/query_posts/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 1 participant
 * Last reply from: [z1webb](https://wordpress.org/support/users/z1webb/)
 * Last activity: [14 years, 5 months ago](https://wordpress.org/support/topic/sticky-posts-in-query_posts/#post-2444590)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
