Hide 'Create Topic' on home page?

Is it possible to hide the ‘create topic’ button on the home page?

i would like my users to navigate to the appropriate category/subcategory before posting a topic, because then the correct category option is automatically placed in the composer, instead of having to scroll through what will be hundreds of categories and subcategories in the drop down menu looking for the right one.

Does anybody know how to do this please?

Try this CSS Rule

body:not([class*='category-']) #create-topic {
    display: none;
}

It will only let the create-topic button appear on category pages.

7 Likes

Yes cpradio, absolutely perfect, top notch support.

many thanks.

actually, can the code be tweeked to show the ‘create topic’ button also in category>subcategory>tag?

Just to confirm, you have show filter by tag enabled?

i do indeed have it enabled.

so when someone goes to service(category)>county(subcategory)>town(tag) the create topic button is shown.

K, this is what you will want then

body:not([class*='category-']) #create-topic {
    display: none;
}

body.tags-page #create-topic {
    display: block;
}
5 Likes

Yes, The ‘create topic’ button now shows up on the page when a tag is selected.

absolute genius. i love you guys.

This populates the composer with the correct category and the correct tag.

:+1:

1 Like

Thanks also from me @cpradio, it would be great as a feature.
Unfortunately it doesn’t work with mobile devices :pensive:

I have tried everything but I don’t understand how to hide “Create Topic” with mobile devices.
With small displays it is difficult to browse categories and tags, this #feature would help a lot, why not add an option to the menu? :smiley:

You can use your browser’s Style Inspector. It shows that the declaration is overwritten by a more specific one on mobile:

Screenshot from 2021-04-07 18-57-16

So you can either use the more specific declaration for mobile yourself:

body:not([class*="category-"]) .list-controls .container #create-topic {
    display: none;
}

Or give your general declaration priority with the !important property:

body:not([class*="category-"]) #create-topic {
    display: none !important;
}
2 Likes

Thanks @nolo I used the !important property and it works perfectly!

1 Like