Title: Fields and sorting
Last modified: August 19, 2016

---

# Fields and sorting

 *  [Aazula](https://wordpress.org/support/users/aazula/)
 * (@aazula)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/fields-and-sorting/)
 * Hello:
 * I need the ability to add fields to posts within a category on my site. The category’s
   content theme is Events. So adding posts assigned to this category generates 
   a list of Upcoming Events.
 * Now, I want such posts to have a Field where I can type in the date of the event.
 * Then I want to the posts assigned to that category to be sorted by the date in
   that Field, eg, the soonest date stuff first.
 * Any suggestions?

Viewing 1 replies (of 1 total)

 *  [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * (@vtxyzzy)
 * [15 years, 3 months ago](https://wordpress.org/support/topic/fields-and-sorting/#post-1922830)
 * You can add a Custom Field to each post with the date. Just be sure the date 
   is in the format ‘yyyy-mm-dd’. Then you can sort on the date by using a query
   something like this:
 * `query_posts('cat=22&meta_key=Date&orderby=meta_value&order=DESC');`

Viewing 1 replies (of 1 total)

The topic ‘Fields and sorting’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 1 reply
 * 2 participants
 * Last reply from: [vtxyzzy](https://wordpress.org/support/users/vtxyzzy/)
 * Last activity: [15 years, 3 months ago](https://wordpress.org/support/topic/fields-and-sorting/#post-1922830)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
