Hiding subcategories of a particular category on the homepage
-
@pichalite Hmm, is there a way to hide a particular category by modifying the template file?
Here's what I'm doing now, but I was wondering if there is a better way:
$('.categories li div:has(h2 a[href$="CATEGORY-NAME"]) .category-children').addClass("hidden");
-
It would be faster as a CSS rule using the category id, but no better way I know of.
li[component="categories/category"][data-cid="33"] .category-children { display: none; }
-
@geek NodeBB's template engine can only do true/false and 0/1 checks. You can't do other validations. So, you will have to modify core to achieve that.
If you are OK modifying core then this is the line you want to add the category id check to
https://github.com/NodeBB/NodeBB/blob/master/public/src/modules/helpers.js#L106
Copyright © 2024 NodeBB | Contributors