I have a custom post type that is simply titles with a date field. I want to display these posts in a list in order of this date field (not date posted). So simply:
—
Sample date
Event title 1
Event title 2
Sample date
Event title 3
Event title 4
Event title 5
(etc)
—
No extra info, that’s literally all I want to display.
I can’t figure out how to go about this at all. I’m not great at PHP so I’d appreciate any help with this.
I solved the same problem like this
First you store each posts in another array called
$events_by_date
with date as the index. If another event post falls in the same date you put that post under the same index.Please comment if you need further explanation.
Just use WP_Query like this: