Title: Conditional offset of posts
Last modified: August 19, 2016

---

# Conditional offset of posts

 *  Resolved [wdawson](https://wordpress.org/support/users/wdawson/)
 * (@wdawson)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/conditional-offset-of-posts/)
 * OK, HTML and CSS I have no problem with. PHP I’m still learning. This is the 
   situation: I have two categories, A and B. On my main page, I have a slot for
   the newest post (in either category). Under that, I have two columns, one with
   the newest 5 posts from category A, one with the newest 5 posts from category
   B.
 * What I would like to do is conditionally offset the posts in the columns so that
   the newest post is not displayed twice. IE, if the newest post is from category
   A, the category A column offsets 1 post but the category B column does not, and
   vice versa.
 * I say conditionally offset just to clarify what I’m talking about, not trying
   to imply this is the right technical term… I’m open to different forms of solutions.
   Thanks so much in advance!

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Michael](https://wordpress.org/support/users/alchymyth/)
 * (@alchymyth)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/conditional-offset-of-posts/#post-1662580)
 * check:
    [http://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action](http://codex.wordpress.org/The_Loop#Multiple_Loops_in_Action)
 * in particular this example:
 * > Alternatively you can pass the entire $do_not_duplicate array to $wp_query 
   > and only entries that match your criteria will be returned:
 *     ```
       <?php query_posts(array('post__not_in'=>$do_not_duplicate));
        if (have_posts()) : while (have_posts()) : the_post();
        ?>
       ```
   
 * and in general:
    [http://codex.wordpress.org/Function_Reference/query_posts](http://codex.wordpress.org/Function_Reference/query_posts)
 *  Thread Starter [wdawson](https://wordpress.org/support/users/wdawson/)
 * (@wdawson)
 * [15 years, 8 months ago](https://wordpress.org/support/topic/conditional-offset-of-posts/#post-1662661)
 * Great, thanks. Had checked the codex but hadn’t seen that for some reason.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Conditional offset of posts’ is closed to new replies.

## Tags

 * [conditional](https://wordpress.org/support/topic-tag/conditional/)
 * [offset](https://wordpress.org/support/topic-tag/offset/)

 * 2 replies
 * 2 participants
 * Last reply from: [wdawson](https://wordpress.org/support/users/wdawson/)
 * Last activity: [15 years, 8 months ago](https://wordpress.org/support/topic/conditional-offset-of-posts/#post-1662661)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
