Home › Forums › Calendar Products › Events Calendar PRO › Hide Specific Filter Bar Categories
- This topic has 3 replies, 2 voices, and was last updated 6 years, 9 months ago by Wesley E Childers.
-
AuthorPosts
-
July 10, 2017 at 8:32 am #1318427Wesley E ChildersParticipant
I have added the functions.php code detailed elsewhere on these forms but I’m seeing the same strange issue mentioned on this thread where every-other category in the array is not being hidden. It looks like the thread was closed before a solution was documented:
https://theeventscalendar.com/support/forums/topic/hide-categories-from-filter-bar/
Any idea how to fix this? I have a long list of sub-categories I need to hide to make the filter bar more manageable/usable on my site.
July 11, 2017 at 8:41 am #1319521BarryMemberHi Wesley,
Thanks for posting!
One thing I should point out right away is that – though we do share snippets in an effort to point users like yourself in the right direction – custom development tasks are generally something we need to leave in your hands.
Here’s an alternative snippet you might try, loosely based on the one in the topic you mentioned, which takes a list of category slugs and removes them from Filter Bar’s category filter. Want to give that a try?
function remove_specific_categories_from_filterbar( $values, $filter_slug ) { if ( 'eventcategory' !== $filter_slug ) { return $values; } $unwanted = array( 'category-slug-1', 'category-slug-2', /* more slugs as needed */ ); foreach ( $values as $key => $value ) { if ( in_array( $value['data']['slug'], $unwanted ) ) { unset( $values[ $key ] ); } } return $values; } add_filter( 'tribe_events_filter_values', 'remove_specific_categories_from_filterbar', 10, 2 );
Hopefully it helps or at least gets you started in the right direction 🙂
August 2, 2017 at 9:35 am #1329521Support DroidKeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Hide Specific Filter Bar Categories’ is closed to new replies.