Support

Home Forums Event Espresso Premium EE3 find parent category from registration page

EE3 find parent category from registration page

Posted: August 18, 2014 at 8:04 am

Viewing 5 reply threads


eachnewdesign

August 18, 2014 at 8:04 am

Hi. I need to find the parent category of an event when on the registration page to be able to display a custom sidebar for each parent category and its sub categories. The structure of my events is:

Parent cat 1
– sub cat 1
– sub cat 2
– …
Parent cat 2
– sub cat 1
– sub cat 2

essentially what I am trying to do is display a custom event list of all events that are under the current events parent category.

so, I am viewing an event from Parent cat 2 – sub cat 1… I need to be able to look up the parent category (parent cat 2) and display all its sub category events.

I hope that is clear enough.

Any help would be appreciated


Tony

  • Support Staff

August 18, 2014 at 8:49 am

Hi,

Although you mention EE3 in the title, EE3 does not allow for hierarchical categories for use within the events by default.

Is this using EE4, categories within WP Pages/Posts? Or if not could you explain a little more how this is setup please?


eachnewdesign

August 18, 2014 at 9:54 am

sry, I mixed up the Posts categories with event categories.

What I am trying to do is link related categories into groups and filter the events that are displayed (as a sidebar menu when on the registration page) based on the event being viewed and its category.

Scenario: there are six schools (top level category) each has its own categories of classes being offered… user selects school and is only shown its categories of classes.

So, what I need is this kind of flow
school 1
– sub cat 1
– event 1
– event 2
– sub cat 2
– event 3
– event 4
school 2
– sub cat 2.1
– event 5
– event 6
– sub cat 2.2
– event 7
– event 8

so when viewing event 8, I would only see events 5,6,7 as a sidebar menu.

I can separate the Schools into pages with categories added to the events_list shortcode… but the registration page (and checkout, cart, etc) view is common to all “schools” so I need a way of maintaining the selected school filter

any suggestions?

thank you for the help

Pat


Dean

August 19, 2014 at 5:14 am

Hi Pat,

Before we go any further can we just clarify if this is for EE3 or EE4 please? The answers will be very different for each version.


eachnewdesign

August 19, 2014 at 1:25 pm

Hi Dean, I am using EE3. Thanks for the help.

Pat


Dean

August 20, 2014 at 2:15 am

Hi,

Thanks for the clarification.

In EE3, event categories do not allow parent-child relationships.

I think what you want to do can still be done, but it will require a lot more coding and maintenance (you will need to update the code each time a new category is added).

You can easily get the event category using $category_name = espresso_event_category_data($event_id, TRUE); in the event_list_display.php file.

From there you could compare it to an array of categories and load the events up by category.

It will certainly take some work to do, and will likely require a custom shortcode, and possibly assistance from a developer (we have a recommended developer list here: https://eventespresso.com/developers/event-espresso-pros/ )

Viewing 5 reply threads

The support post ‘EE3 find parent category from registration page’ 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