order by category
-
The website I work for is a local monthly magazin for events, so I have many events per day. I want to show the events like in the magazin: grouped by daily and category. As I look in the wordpress tables I understand, that there is no field for categories in wp_em_events like the normal WordPress Taxonomies.
This article EVENT AND LOCATION GROUPING AND ORDERINGsaid, that groupby and orderby can be use with any field from wp_em_events and wp_em_locations tables. So I decided to change the event_slug field of the any event. It is now category-term_id plus the event_name. This can be done by a plugin later that fires on save new or edit events.
Example data:
Event1 – Name: “Konzert”, Category-Name: “Bühne”, Category-Term-ID(Bühne): “219”, new event_slug: “219-konzert”, start_date: 21.02.2019 19:30Event2 – Name: “Theater”, Category-Name: “Kinder”, Category-Term-ID(Kinder): “220”, new event_slug: “220-theater”, start_date: 21.02.2019 20:30
Event3 – Name: “Party”, Category-Name: “Bühne”, Category-Term-ID(Bühne): “219”, new event_slug: “219-party”, start_date: 21.02.2019 23:30
On the event page I use this:
[events_list_grouped mode=”daily” orderby=”event_slug”]#_EVENTNAME<br/>[/events_list_grouped]So I hope, I get this output order: Event1, Event3, Event2 – first the events from the category “Bühne”, then category “Kinder”.
But I get this: Event1, Event2, Event3. It is still ordered by start_date.
In another test I edit the fields group_id from table wp_em_events and save the category-term-id in there. No Buddypress needed, so the field is empty and useless for this page. But this failed too.
Is it really true that orderby can be use with any field from wp_em_events? How can I handle this?
- The topic ‘order by category’ is closed to new replies.