Title: Custom post order
Last modified: August 21, 2016

---

# Custom post order

 *  [Mirek2](https://wordpress.org/support/users/mirek2/)
 * (@mirek2)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/custom-post-order-1/)
 * Hi guys,
    I’m working on this website where [the homepage](http://otevrioci.cz/)
   is composed of both events (managed using the [Events Calendar plugin](http://wordpress.org/plugins/the-events-calendar/))
   and articles. Currently, both are sorted by creation date.
 * I’d like to have the events sorted by their start date, while I’d like to order
   the articles by their creation date (still with both on the same page). How do
   I accomplish this?

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

 *  Moderator [Jose Castaneda](https://wordpress.org/support/users/jcastaneda/)
 * (@jcastaneda)
 * THEME COFFEE MONKEY
 * [12 years, 3 months ago](https://wordpress.org/support/topic/custom-post-order-1/#post-4562203)
 * One way I can think of would be using [WP_Query](https://wordpress.org/support/topic/custom-post-order-1/codex.wordpress.org/Class_Reference/WP_Query?output_format=md).
   Create one query for the events and the other for the articles/posts.
 *  Thread Starter [Mirek2](https://wordpress.org/support/users/mirek2/)
 * (@mirek2)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/custom-post-order-1/#post-4562211)
 * I should mention that I want the articles to appear among the events. (For example,
   say one event takes place on Jan. 5, another on Jan. 7, but both events were 
   created on Jan. 2. If I create an article on Jan. 6, I want it to appear in between
   the two events.)
    Is that possible with WP_Query?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [12 years, 3 months ago](https://wordpress.org/support/topic/custom-post-order-1/#post-4562268)
 * Not entirely. You’ll need to filter ‘posts_orderby’ to insert a complex orderby
   clause. WP_Query should form the remainder of your query just fine though.
 * I’m unsure of what that complex clause would be, or if it’s even possible. Some
   sort of sub-query that returns one date or the other depending on the post type
   or whatever distinguishes articles from events.
 * If that doesn’t work, you could sort the returned array with PHP and `usort()`.

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

The topic ‘Custom post order’ is closed to new replies.

## Tags

 * [events](https://wordpress.org/support/topic-tag/events/)
 * [list](https://wordpress.org/support/topic-tag/list/)
 * [order](https://wordpress.org/support/topic-tag/order/)
 * [post order](https://wordpress.org/support/topic-tag/post-order/)
 * [posts](https://wordpress.org/support/topic-tag/posts/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 3 replies
 * 3 participants
 * Last reply from: [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * Last activity: [12 years, 3 months ago](https://wordpress.org/support/topic/custom-post-order-1/#post-4562268)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
