Hello,
I was wondering if I can do something do an EVENT LIST short code and then also add in that an order_by meta value I created? How would I that look coded out if possible?
The orderby attribute in the shortcode goes directly into the sql query as an orderby clause. Since the meta key – value pairs are stored as a serialized array in the database in a single sql field, sql cannot use a meta value in the orderby clause. You would need to customize the function event_espresso_get_event_details in the event_list.php template file. Add a new order_by_meta attribute. Then after the events are fetched from the DB (line 185) run a foreach to go through each event, unserialize it’s event meta, grab the value from the key that is in your new order_by_meta attribute, and use that value as the key to build a new array of events. Replace the old array of events that came from the DB with your new array of events, and when the rest of the code goes to loop over the events, it should do so in the new order.
Viewing 2 reply threads
The support post ‘Combine short codes for lists?’ is closed to new replies.
Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.
Support forum for Event Espresso 3 and Event Espresso 4.