Support

Home Forums Event Espresso Premium Extract event categories and description

Extract event categories and description

Posted: August 8, 2018 at 11:06 am


FumballyStables

August 8, 2018 at 11:06 am

Hi guys,

We want to customise the events page in order to show events grouped by categories in a grid layout and show the category description for each category.

I have seen that Josh shared this useful example to extract events:
https://gist.github.com/joshfeck/e3c9540cd4ccc734e755

I wonder if it’s possible to create a customised query to extract the categories and the use the categories retrieved from the query to get all the events by category.

Thanks so much for you support,
Federico


Josh

  • Support Staff

August 8, 2018 at 1:35 pm

Hi Federico,

The example from that gist was intended to do one list. You might look into the Grid template add-on where you can set up multiple shortcodes displaying categories of events on a page. This method allows for displaying the category description too.

https://eventespresso.com/wiki/events-grid-view-template-add-on/


FumballyStables

August 9, 2018 at 3:27 am

Hi Josh,
Thank you for your message.
We were wondering if there is another method to extract all the categories, that might be useful to customize the view. We’d like to have a page with the name and description of each category and below each category the events related to that category.


Tony

  • Support Staff

August 9, 2018 at 5:49 am

EE categories are terms in a custom taxonomy, so you can use get_terms to pull all of the EE categories, for example:

$taxonomy = array('espresso_event_categories');
$args = array('orderby'=>'name','hide_empty'=>true);
$ee_terms = get_terms($taxonomy, $args);

$ee_terms will be an array of WP_Term objects.

Is that what you are looking for?


FumballyStables

August 9, 2018 at 6:25 am

Hi Tony,

Yes, your solution will be very helpful.
Thanks very much guys.

Federico

The support post ‘Extract event categories and description’ 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