soderlind / acf-field-date-time-picker

Date and Time Picker field for Advanced Custom Fields v3 and v4
GNU General Public License v2.0
65 stars 27 forks source link

Can't order posts correctly, because saving as timestamp doesn't work! #93

Open der-lukas opened 9 years ago

der-lukas commented 9 years ago

Hey!

I'm running WP 4.2.2, ACF 4.4.2 and the latest version of acf-field-date-time-picker. Your plugin doesn't work when I'm trying to save the values as timestamps. Now I chose to save the values as strings, but this makes a problem with ordering my posts in WP Query, as you can see in this image:

http://i.imgur.com/NbeeVEp.png?1

The last of the three entries ("Bananaboat") has an earlier start-time as the once before, so it should be on top of the other two posts.

My Field Settings look like this:

http://i.imgur.com/smNEFsu.png?1

.. and my WP-Query Arguments:

$args = array (
        'post_type'              => 'event',
        'post_status'            => 'publish',
        'orderby'                => 'meta_value',
        'meta_key'               => 'von',
        'order'                  => 'ASC',
        'posts_per_page'         => -1,
);

("von" is the field name of the date-time-picker-field)

But as the value is not saved as a timestamp, it seems to have issues ordering the posts correctly...

Do you have any idea how I could go about solving this problem? I'm a little under pressure with a deadline coming up... -.-

All the best, Lukas