Tagged: breadcrumbs, categories
-
AuthorPosts
-
May 5, 2015 at 1:20 am #439436
I have a particular category that I use for organizing posts, but it’s more of a “hidden” category that is just for me (not for the public). Is there anyway for me to exclude this particular category from being shown in the breadcrumbs? Please advise. Thanks!
May 5, 2015 at 8:19 pm #439973Hi ACNLatitudes!
Try adding this to the bottom of your functions.php file.
add_filter( 'avia_breadcrumbs_trail', 'enfold_customization_breadcrumbs_remove', 2, 10 ); function enfold_customization_breadcrumbs_remove( $trail, $args ) { $i = 0; foreach ($trail as $t) { if (strpos($t, 'cat=9') != false) { unset($trail[$i]); } $i++; } return $trail; }
I had my permalinks set to default so I tested for cat=9 in each of the breadcrumb trails. You can replace cat=9 with the name of your category.
It will also remove any other crumb that uses the same term though so you may want to change cat=9 to the URL of your category archive instead.
Or if your category slug is “test” for example then do this.
if (strpos($t, 'test') != false) { unset($trail[$i]); }
Cheers!
Elliott- This reply was modified 9 years, 7 months ago by Elliott.
May 8, 2015 at 9:00 pm #441772OK. Thanks, I’ll try that out!
May 11, 2015 at 10:09 am #442317Hi!
Alright. We’ll keep the thread open. Let us know if it works.
Best regards,
IsmaelJuly 4, 2015 at 9:57 pm #468430Hello. Thanks for providing this code. I will try it out and let you know if I have any issues.
On a related note, will this code also prevent the category from being shown directly below the title of the post (the area where it shows all of the categories that are associated with the post? If not, is there some additional code that will be needed to hide the category from that area as well?
Thanks!
July 6, 2015 at 2:14 pm #468919Hi!
Are you talking about in the single post view where it lists the post meta?
Best regards,
ElliottJuly 6, 2015 at 4:21 pm #469062Hi Elliott,
Thanks for the reply. I would effectively like to hide the specific category from showing up ANYWHERE in the theme (breadcrumbs, post meta, etc.). Please advise.
Thanks!
July 6, 2015 at 5:40 pm #469141Hey!
Send us a link to your post and let us know which category it is.
Regards,
Elliott- This reply was modified 9 years, 5 months ago by Elliott.
July 6, 2015 at 6:10 pm #469169Hi Elliot. OK. I have provided a few links that show the category on the post and have also provided the category name in the Private Content area. I also provided a temporary login if needed. Thanks!
July 7, 2015 at 3:33 pm #469731Hi!
Try adding this to your custom CSS.
a[href*="/category/evergreen/"] { display: none !important; }
Regards,
ElliottJuly 13, 2015 at 8:21 pm #472654That worked great. Thanks!
July 14, 2015 at 9:30 am #472908 -
AuthorPosts
- The topic ‘Hiding a Particular Category from Breadcrumbs’ is closed to new replies.