Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #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!

    #439973

    Hi 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 4 years, 2 months ago by  Elliott.
    #441772

    OK. Thanks, I’ll try that out!

    #442317

    Hi!

    Alright. We’ll keep the thread open. Let us know if it works.

    Best regards,
    Ismael

    #468430

    Hello. 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!

    #468919

    Hi!

    Are you talking about in the single post view where it lists the post meta?

    Best regards,
    Elliott

    #469062

    Hi 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!

    #469141

    Hey!

    Send us a link to your post and let us know which category it is.

    Regards,
    Elliott

    • This reply was modified 4 years ago by  Elliott.
    #469169

    Hi 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!

    #469731

    Hi!

    Try adding this to your custom CSS.

    a[href*="/category/evergreen/"] {
      display: none !important;
    }

    Regards,
    Elliott

    #472654

    That worked great. Thanks!

    #472908

    Hi!

    Glad we could help :)

    Best regards,
    Rikard

Viewing 12 posts - 1 through 12 (of 12 total)

The topic ‘Hiding a Particular Category from Breadcrumbs’ is closed to new replies.