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'm struggling with the query for this in WordPress to display posts in a category from the 6th most recent onwards.

Basically, I have a top 5 posts section at the top of a category for featured posts (marked as posts in that specific category AND in a Featured category), then in the page content I don't want any of those top 5 featured posts shown in the regular posts loop.

Any help would be greatly appreciated.

$query = new WP_Query( array( 'category__and' => array( 2, 6 ), 'offset' => 5 ) );
share|improve this question
And your code looks like..? – Wyck Dec 4 '12 at 3:13
up vote 0 down vote accepted

Without seeing your code, here's a rundown that should work for you.

  1. At the top of your template file, start an array, $featured_posts = array();
  2. In your featured posts loop, in each iteration, add the ID of the post to the array, $featured_posts[] = get_the_ID();
  3. In your second loop, check to see if the post was already displayed, and if so, skip to the next iteration of the loop: if ( in_array( get_the_ID(), $featured_posts ) ) continue;
share|improve this answer
Perfect. Thank you, this worked great! – Geeves Dec 5 '12 at 9:48

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.