Support

Home Forums Event Espresso Premium Display events that are members of two categories.

Display events that are members of two categories.

Posted: November 29, 2018 at 7:51 am

Viewing 3 reply threads


johncleary

November 29, 2018 at 7:51 am

Hi.

On my website, I have different categories of event e.g. Beginners, Intermediate etc. I am lucky that I have a lot of existing clients and I want to offer the events firstly to them and once they have had the chance to book, then open up to website visitors. There are different pages on my site for the various categories.

The way I thought I would do this with minimum website editing is to have a ‘Type’ parent category that contains ‘Beginner’ and ‘Intermediate’ plus a ‘Visibility’ parent category that contains ‘Client’ and ‘All’.

So now I need to be able to show using a shortcode all the events that are categorised as ‘Beginner’ AND ‘All’. Having found this on the forums, I thought that I might be able to use something like:

[ESPRESSO_EVENTS category_slug=beginner+all]

But that doesn’t seem to work; how do I do this please?


Josh

  • Support Staff

November 29, 2018 at 2:42 pm

Hi,

This is actually quite complicated because [ESPRESSO_EVENTS category_slug={}] can accept only one category.

I did some checking and the one way I could find to make this happen with a shortcode was with the Display Posts Shortcode plugin. The plugin can be downloaded from here:
https://wordpress.org/plugins/display-posts-shortcode/

Then, in order to filter by both “Beginner” and “All”, one of them will need to be a tag (instead of a category). So for example, “Beginner” can be an event category, and “All” can be a tag. Then, to display a list of events that are in the “Beginner” event category AND are tagged “All”, you’d use this shortcode:

[display-posts post_type="espresso_events" taxonomy="espresso_event_categories" tax_term="beginner" taxonomy_2="post_tag" tax_2_term="all" tax_operator="AND" order="DESC"]


johncleary

November 30, 2018 at 2:51 am

Josh, you are an absolute STAR! Thanks so much for this, I’d have never worked that out!

Your solution works a treat and does exactly what I needed it to do. Thanks so much.


Josh

  • Support Staff

November 30, 2018 at 1:50 pm

Great to hear.

One other thing you might want to do, if you don’t want past events displayed in that list, is add this code to a functions file/plugin on your site:

https://github.com/eventespresso/ee-code-snippet-library/blob/master/templates/de_ee_filter_events_out_with_expired_tickets.php

You can add the above to a functions plugin or, if applicable, into your WordPress child theme’s functions.php file.

What that will do is make it show only events that are available for registration, so past events will not be displayed.

Viewing 3 reply threads

The support post ‘Display events that are members of two categories.’ 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