Hi there, and thank you for your time.
First of all, please look at this page: hidden link
The posts here are created by members submitting a Cred form which allows them to enter details in lots of fields which are assigned to the custom post type "courses". All fields, post types and forms are created in Toolset.
It works beautifully to this point.
As you will see however on that pate, there is one issue: the posts are displayed out of date order. They should show the next event first in the list, then with events getting later as you scroll down the list.
Can you tell me how to order these events in date order (the field is called "start-date-for-event") and importantly how that is achieved direct in the taxonomy-coursetypes-one-day-course.php template file, rather than in the Views module as we have created the site in template files.
I hope you can help.
Many thanks and best wishes,
Andrew.
Hi, if you are not using Views to display your data, then sorting your posts must be handled in your custom code. Here is the documentation for the "order" and "orderby" parameters:
https://codex.wordpress.org/Class_Reference/WP_Query#Order_.26_Orderby_Parameters
Orderby a meta value is described in the docs. Types fields are saved in the postmeta table as "wpcf-" + slug, so if your field slug is "start-date-for-event" then the meta key for that field is "wpcf-start-date-for-event".