I have a wp_query for a custom post type: events. I have a seven day calendar that is showing featured events on a page. Here is the wp_query and supporting code:


you can see the calendar at seattleite.com/calendar/

the thing works great with one exception. It should be showing a featured event on Sunday. If I change the order => 'asc' to order => 'desc' I see the event for sunday but then I lose the event for today.

If I simply remove the order => item then I see what I see if I set order => 'desc'

any idea how order is affecting my loop?


If anyone comes across this question. WordPress Codex says the following to 'orderby' => 'meta_value' and the order param:

Note also that the sorting will be alphabetical which is fine for strings (i.e. words), but can be unexpected for numbers (e.g. 1, 3, 34, 4, 56, 6, etc, rather than 1, 3, 4, 6, 34, 56 as you might naturally expect).

You are querying event dates, so the order of the results might be wrong because of this alphabetical sorting.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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