Support

Home Forums Event Espresso Premium Hide People/Collapse in Event Category List

Hide People/Collapse in Event Category List

Posted: May 17, 2019 at 9:53 am


dangbird

May 17, 2019 at 9:53 am

Hey Team – Great support thank you. When I use a Event Category Menu item it will list the Events of that Category Perfectly. However if I add People using the People Add on as Trainers, it lists all the trainers for that event and their bios. Is there any way to suppress or HIDE the Traininers on the Category View, and just show them on the Event Detail Page, or Have the People show inside the Details View?


Josh

  • Support Staff

May 17, 2019 at 12:34 pm

Hi,

Yes there is a way to remove the trainers when it’s a category view. You can add the following code snippet to your site:

https://gist.github.com/joshfeck/45c94379ac1443b0b0702b7dd1c092c3

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


dangbird

May 17, 2019 at 1:02 pm

I added the Code, and the Trainer still shows. To be clear this view is the Menu Item “Event Category” not an actual page or archive page. Is there some code change needed for the Menu View?


Josh

  • Support Staff

May 17, 2019 at 1:31 pm

It should work regardless of the page/post type. Was the code added to a plugin, and if so is the plugin activated?


dangbird

May 17, 2019 at 1:39 pm

This reply has been marked as private.


Josh

  • Support Staff

May 17, 2019 at 1:47 pm

The Plugin “Snippets” is probably loading the code too late in the request. The code needs to be loaded before the AHEE__EED_Events_Archive__use_filterable_display_order__after_add_filters hook point, which is fairly early in the request.

If you add the same code to either the theme’s functions.php file or into a plugin file (similar to the plugin outlined in this guide) then the code will load early enough to do its thing.


dangbird

May 17, 2019 at 1:53 pm

Thanks Josh, I tried putting the Code at the Bottom of the functions.php file as well as the top, and it did not seem to make a difference.
Any other suggestions?


Josh

  • Support Staff

May 17, 2019 at 2:20 pm

That’s really strange. I added the same code to my site’s theme’s functions.php file, and the People listing disappeared from the event category list.

You could try adding the code to an activated site-specific code plugin.


Josh

  • Support Staff

May 17, 2019 at 7:47 pm

One reason why the code I shared with you wouldn’t work, is if the Use Custom Display Order? option is set to Yes. That’s a setting in Event Espresso > Events > Templates, under the heading “Event List Pages”.

If that is set to Yes, then this is the code to use to remove the people listing on event category pages:

add_action(
 'AHEE__EED_Event_Archive__initialize_template_parts',
  function() {
   remove_action(
    'AHEE__EED_Event_Archive__initialize_template_parts',
    array('EED_People_Event_Template_Parts', 'add_event_archive_template_parts'),
    10
   );
  },
  9
);


dangbird

May 20, 2019 at 12:16 pm

Hi Josh – This worked Perfectly. Thank you I am all set.
FYI – I did use “Code Snippets” Plugin and it worked with your code great!

The support post ‘Hide People/Collapse in Event Category List’ 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