Title: Stick post loop from example code does not work
Last modified: August 18, 2016

---

# Stick post loop from example code does not work

 *  [otherjohn](https://wordpress.org/support/users/otherjohn/)
 * (@otherjohn)
 * [19 years, 1 month ago](https://wordpress.org/support/topic/stick-post-loop-from-example-code-does-not-work/)
 * Hi all, I have on my index.php code the following loop codee directly from the
   docs [http://codex.wordpress.org/The_Loop](http://codex.wordpress.org/The_Loop).
   It worked before upgrading to the newwest version 2.1. It doesn not “showpost”
   of just 1 item that is in a cat “Featured”, but instead it shows muliple items.
   And some of those items are not even in that cat.
    What I would like to do is
   show one item (featured) with excerpt as first item then list the rest below 
   it in an different list type.
 *     ```
        <?php $my_query = new WP_Query('category_name=Featured&showposts=1');
                  while ($my_query->have_posts()) : $my_query->the_post();
                  $do_not_duplicate = $post->ID;?>
   
           <!--
       		<?php trackback_rdf(); ?>
       		-->
           	<div class="post" id="post-<?php the_ID(); ?>">
             		<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
             		<div class="postcontent">
       	  			<p><?php the_excerpt(); ?>  </p>
             		</div>
       		</div>
        	<?php endwhile; ?>
   
       		<h1>Recent Articles</h1>
   
       		   <?php if (have_posts()) : while (have_posts()) : the_post(); if( $post->ID == $do_not_duplicate )
       	      continue;?>
   
       <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
       				 <div class="postInfo">
       					<p><?php the_excerpt(); ?> </p>
       				 </div>
        <?php endwhile; ?>
   
       <?php else : ?>
       ```
   

The topic ‘Stick post loop from example code does not work’ is closed to new replies.

## Tags

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

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [otherjohn](https://wordpress.org/support/users/otherjohn/)
 * Last activity: [19 years, 1 month ago](https://wordpress.org/support/topic/stick-post-loop-from-example-code-does-not-work/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
