Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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:

https://gist.github.com/1030760

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?

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

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.