最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

php - Hide a specific category title from displaying on site

programmeradmin0浏览0评论

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

发布评论

评论列表(0)

  1. 暂无评论