So i’ve created a custom post type, and assigned a date/time selector do it.
What i want to do is to edit the post query (which i am doing to include the post type) to sort so that if a date is set to a post, then it sorts by that date. If not, then should just use the post date (and this is true for all other posts).
I don’t want to filter just posts with this set, i want all posts. it’s essentially artifically changing the post_date to be the one set in custom field.
I need to do this as the dates are ahead in time.
Hope someone can help me!
PS: i’ve checked the fields output date, again the post date and the format is identical (2019-04-03 17:00:00).
Viewing 1 post (of 1 total)
The topic ‘Sort posts using ACF date field, if none set, use post date’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users