Sorting wordpress events by date

I have a problem sorting Events in WordPress. I’d like to show the upcoming events first obviously. I have the code below and tried other variations from the WP Codex, etc. none works. My date is in the format of d.M.Y but I don’t think that matters. What happens is the events are sorted by the day of the month and the month is not taken into account.

query_posts(array(
'post_type' => 'cpu_education',
'cpu_education_category' => 'poslovni-seminarji',
'paged' => get_query_var('paged'),
'orderby' => date(), //'meta_value_num',
        "meta_key" => 'cpu_education_start_date',
        "order" => 'ASC'

When I use date() like in the sample code the sorting makes no sense at all. First row is sorted ok but the next rows make no sense. If instead of date I use meta_value_num it sorts the events by the day of the month so I get events starting on 1st always at the top which is not what I want. If tomorrow is 24th I wish that days events be at the top.

Read More

I’d really appreciate if someone can help me out with this. Must be something simple I’m missing. It’s been bugging me for some time.

Related posts