admin管理员组

文章数量:1415111

I have a website that uses the theme Bodega and uses portfolio categories. Right now I have a page like this: http://185.56.86.90/~onetoncr/manitoulifeandhome/property-services/. And it displays the categories beneath the pictures.

I want to hide the category Property Portfolio but I want the other categories to still be showing. Is there a code I can put into the functions.php to hide that specific category? The slug for it is property-portfolio.

I have looked at this post: / and it was successful on a previous site I did but because this one uses a category slug instead of ids, I'm not sure how to get this one to work on this site.

I have a website that uses the theme Bodega and uses portfolio categories. Right now I have a page like this: http://185.56.86.90/~onetoncr/manitoulifeandhome/property-services/. And it displays the categories beneath the pictures.

I want to hide the category Property Portfolio but I want the other categories to still be showing. Is there a code I can put into the functions.php to hide that specific category? The slug for it is property-portfolio.

I have looked at this post: https://kriesi.at/support/topic/hide-specific-categories-from-meta/ and it was successful on a previous site I did but because this one uses a category slug instead of ids, I'm not sure how to get this one to work on this site.

Share Improve this question asked Aug 22, 2019 at 18:02 Laura Morrison PibelLaura Morrison Pibel 1
Add a comment  | 

1 Answer 1

Reset to default 0

You can use the same code, you just have to find the id of your category by slug. Yo can do this by adding :

  $idObj = get_category_by_slug('category-slug'); 
  $id = $idObj->term_id;

And then put $id in your excluding array. the function is documented here : wordpress documentation

本文标签: phpHide a specific category title from displaying on site