Support

Home Forums Event Espresso Premium Combine short codes for lists?

Combine short codes for lists?

Posted: January 22, 2014 at 2:35 pm

Viewing 2 reply threads


Alex

January 22, 2014 at 2:35 pm

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?

[EVENT_LIST category_identifier=your_category_identifier order_by=your_order_value]

Doesn’t seem to work.


Alex

January 22, 2014 at 2:55 pm

The order value is a meta key I created.


Sidney Harrell

January 22, 2014 at 5:31 pm

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.

Event Espresso