WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I was wondering if anyone knew how to have a different "featured post" based on it's category per category page? For example, if you are on the medical category page, you would see a medical post featured in a special div and so on.

share|improve this question
up vote 2 down vote accepted

assign the additional category 'featured' to the post in the category 'medical'.

in your category template, use a query with 'category__and' => array(3, 27)

example (assuming 'medical' is cat 3, and 'featured' is cat 27):

<?php $args = array(
  'category__and' => array(3, 27),
  'posts_per_page' => 1
$feature = new WP_Query( $args );
if( $feature->have_posts() ) : while( $feature->have_posts() ) : $feature->the_post(); ?>
  <div class="featured">
   ANY POST OUTPUT <?php the_title(); ?>
<?php endwhile; endif; ?>
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.