Forums › Forums › Search & Filter Pro › Sort by ACF Date Time Events
- This topic has 4 replies, 2 voices, and was last updated 9 years, 3 months ago by
Trevor.
-
Anonymous(Private) February 13, 2017 at 1:38 pm #89721
Hi,
I’m trying to create events functionality to a site I’m building. I’m using the newest version of ACF Pro and Search & Filter Pro.
I have two fields which should be the basis of how events are displayed in the results page:
date_startanddate_end.I would like to add this functionality to the search form:
Upcoming events – Display all events ordered by
date_start, exclude events wheredate_end >= $current_date.Old events – Display all events ordered by
date_start, exclude events wheredate_end <= $current_date.Choose month – Display all events ordered by
date_startin chosen month.I’m having trouble while testing this and searched around on the forums. I came over a post where Trevor said that the fields should be saved in
yymmdd, but this is not how ACF saves date time fields to the database. Ex of saved db-entry:2017-01-30 14:00:00.Doing a simple sort order test (see screenshot) does nothing (normal post dates work):
Anonymous(Private) February 13, 2017 at 1:45 pm #89724Manually changing the URL gives me the correct results:
From
?sort_order=_sfm_dato_start+asc+numto?sort_order=_sfm_dato_start+asc+dateand?sort_order=_sfm_dato_start+desc+numto?sort_order=_sfm_dato_start+desc+dateBut I can’t actually choose these options in the “Sort Type” dropdown.
Anonymous(Private) February 14, 2017 at 9:08 am #89936ACF Pro only has a Date Time Field (It has a time field, but it does not have a simple Date field).
I believe the actual problem is that the plugin does not allow
Sort Type -> Date(which is a standard WordPress meta sorting value). When I changed the URL (see my previous post in this topic), the sort order corrected itself, but I cannot actually choose this in the plugin.

-
AuthorPosts