How can I remove the Child Categories from the Categories with Featured Topics view?

AI-generated summary

jacob_kahn wants to remove child categories from the Categories with Featured Topics view and asked for help. Canapin provided a CSS solution: .subcategories { display: none; }, but noted it may cause unintended effects if used elsewhere on the forum. Lhc_fl suggested a more specific selector: .categories-list .category-list.with-topics .subcategories { display: none; } to avoid potential issues. jacob_kahn thanked both users for their help. Canapin agreed with the more specific selector and also recommended hiding .subcategories-list for the mobile view.

I’d like to remove the sub-category from this view. Does anyone have any idea how to do that?

Jacob

You can add this CSS to your theme:

.subcategories {
    display: none;
}

From:

To:

I’m not sure .subcategories is the best selector though. I don’t know if it’s used elsewhere on the forum. Then it may cause unintended effects.

So you can use this instead :D.

.categories-list .category-list.with-topics .subcategories {
    display: none;
}

thanks @Canapin and @Lhc_fl

Yeah, that would be safer.


edit: I took a look at Discourse’s code, .subcategories alone should be safe (I personally like to use not too much selector depth if I can avoid it), and you should also consider hiding .subcategories-list as well as it’s the subcategories parent container on the mobile view.