Hidden category appearing again after update

Hi!

The default “Staff” category, which remained hidden since I set up Discourse, suddenly re-appeared on my forum homepage. It seems to be related to an app rebuild I just launched.

Did a setting change for this version?

Thanks!

Yes, depending on what your homepage is set to, that setting only applies to Latest now. If you want to hide it from the Categories page, you have to use CSS.

See Unexpected interaction between "suppress category on homepage" and "user preference for homepage"

2 Likes

I don’t think I can use CSS selectors to match a tr data-category-id. This would have to be done with JS, am I right?

You can target it with the data attribute

tr[data-category-id="4"] {
    display: none;
}
10 Likes

Thanks for teaching me something! It works perfectly.

3 Likes

Thanks for sharing this. I’m curious if there’s a way to have it also affect categories in mobile view? Right now it’s not working for me outside of desktop view. Any advice would be greatly appreciated. I used Discourse for an online interactive narrative experience that has distinct in-world and out-of-world elements. Right now a bunch out-of-world categories are littering my in-world front page in mobile view. Thanks again!

Hi,

I can’t find the post I previous made to which Joshua responded with something very similar, in our case;

.category-list tr[data-category-id="14"] 
{
    display: none;
}

Our problem is that this only appears to work for non mobile platforms, as such, everything we have hidden via CSS still shows on mobile.

Any thoughts/help would be really appreciated.

Just to rule out the obvious, you put that same CSS in the Mobile version (or Common – I think?) of the theme too, right?

1 Like

Right, we were previously missing the data-category-id on the mobile category page, which made it impossible to select specific categories in most cases. I made a change last week to include it so mobile/desktop will work the same, and I believe the update should roll out to you within the next day or so.

6 Likes

It wasn’t myself making the changes but yes, I believe so.

Thanks for checking :slight_smile:

Aha, great stuff, I will mention this to those involved.

Thank you :slight_smile:

Just wantes to check, has our hosted instance beem updated yet? If so, its not working on mobile. If not, any eta @awesomerobot?

1 Like

It’s updated now so you should have what you need on mobile; sorry for the slightly longer than estimated time.

2 Likes

Hi,

Thats ok, just trying to establish if the issue is at our end as at the monent it hasnt changed. Perhaps its cached. Will experiment! :slight_smile:

Hey @awesomerobot ,

We are still having problems with this. The sub-categories in question don’t appear via desktop, but still appear on mobile. Any help would be really appreciated.

The hosted site is : https://community.gamedev.tv

1 Like

There’s a difference in how the HTML is built so this bit of CSS:

.category-list tr[data-category-id="25"] { 
    display: none;
}

is only targeting the tr we use on desktop, and not the div we use on mobile.

If the tr is removed it should work on mobile and desktop:

.category-list [data-category-id="25"] { 
    display: none;
}
6 Likes

His Kris,

Thanks for the reply and info… excitedly running off to test this now! :slight_smile:

…excitedly runs back… ironically I cant seem to scroll in the text area where the CSS is displayed when using my mobile so will have to try when I return home. :face_with_hand_over_mouth:

*BOOM*

Thanks so much for this Kris, it has been a mild iteration for so long and to have it finally resolved feels great.

:slight_smile:

3 Likes

Hi,

Does this CSS still work? I am struggling to have it hide Categories for me.

.category-list [data-category-id="25"] { 
    display: none;
}

Are the Category IDs for the Lounge and Staff Categories the same for each installation?

This topic was automatically closed after 2293 days. New replies are no longer allowed.