title: Fetch WordPress sticky posts from category
body: <p>I have been working on this for a while basically i am trying to fetch the top three stick posts from a specific category in WordPress and display them only. I have some code below however this is fetching all the posts not just the specific ones marked as sticky in that category.</p>
  
  <pre><code>&lt;?php $sticky=get_option('sticky_posts');
  $query_args=array(
  'post__in' =&gt; $sticky,
  'category__in'=&gt;array($category)
   );
  $the_query = new WP_Query($query_args); ?&gt;
  &lt;?php $count = 0; ?&gt;  
  &lt;?php while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); $do_not_duplicate =      $post-&gt;ID; ?&gt;
  &lt;?php $count++; ?&gt;  
  
  &lt;?php if ($count == 1) : ?&gt;  
      &lt;div class="featurethumb"&gt;&lt;?php the_post_thumbnail(array(306,306), array ('class' =&gt; 'featurethumb')); ?&gt;
  &lt;div class="featuretitle-bg"&gt;&lt;div class="featuretitle"&gt;&lt;a title="&lt;?php the_title(); ?&gt;" href="&lt;?php the_permalink() ?&gt;" rel="bookmark"&gt;&lt;?php the_title(); ?&gt;&lt;/div&gt;
  &lt;div class="featured-desc"&gt;&lt;?php the_excerpt(__('(more…)')); ?&gt;&lt;/div&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;?php elseif ($count == 2) : ?&gt;  
      &lt;div class="index-thumb"&gt;&lt;?php the_post_thumbnail(array(100,100), array     ('class' =&gt; 'alignleft1')); ?&gt;&lt;/div&gt;
  &lt;div class="indexblog-title"&gt;&lt;a title="&lt;?php the_title(); ?&gt;" href="&lt;?php the_permalink() ?&gt;" rel="bookmark"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;?php the_excerpt(__('(more…)')); ?&gt;
  &lt;?php else : ?&gt;  
      &lt;div class="index-thumb"&gt;&lt;?php the_post_thumbnail(array(100,100), array   ('class' =&gt; 'alignleft2')); ?&gt;&lt;/div&gt;
   &lt;div class="indexblog-title"&gt;&lt;a title="&lt;?php the_title(); ?&gt;" href="&lt;?php the_permalink() ?&gt;" rel="bookmark"&gt;&lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/div&gt;
  &lt;?php the_excerpt(__('(more…)')); ?&gt;
  &lt;?php endif; ?&gt;
  
   &lt;?php endwhile; ?&gt;
  </code></pre>