Home › Forums › Calendar Products › Filter Bar › Hide category option from filter bar
- This topic has 1 reply, 2 voices, and was last updated 5 years, 10 months ago by sm2dev.
-
AuthorPosts
-
May 15, 2018 at 2:57 pm #1531223sm2devParticipant
Hi,
Support previous helped me [Help Desk-Ref: 1509722-57295-eab969ee31] add the WordPress core Categories taxonomy to the Filter Bar. I need to hide a category from displaying on the front end. I’m wondering if you can tell me how I do that based on the code that support provided for me previously?
Here is a link to the code Juan provide: https://gist.github.com/juanfra/be7f4052ebb113278fef88a3a38a5d73#file-tec-filter-bar-category-wordpress-php
Thank you.
May 16, 2018 at 6:18 am #1531583VictorKeymasterHi Daniel!
Thanks for getting in touch with us!
First, please let me note that we are fairly limited in how much support we can give for custom development questions like that.
That said, we always like helping out and at least point users into the right direction as much possible.
If you want to prevent a specific category from showing up in the filter, you can do so by excluding it in the get_terms function. You should modify the following line of the code https://gist.github.com/juanfra/be7f4052ebb113278fef88a3a38a5d73#file-tec-filter-bar-category-wordpress-php-L21
so that it looks like:
$source = get_terms( 'category', array( 'orderby' => 'name', 'order' => 'ASC', 'exclude' => array( 16 ) ) );
where 16 is the category id you want to exclude.
I hope that helps! 🙂
Best,
VictorJune 7, 2018 at 9:35 am #1548558Support 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 category option from filter bar’ is closed to new replies.