How can I remove the New Topic button from the main page? I only want it to appear when a user selects a category.
AI-generated summary
In a discussion titled “Remove New Topic Button” under the Dev category with the tag CSS, baileysteelefarm asked how to hide the New Topic button on the main page while keeping it visible when users select a category. neounix suggested using CSS to target the button by its ID (button#create-topic) and hide it with display:none;, also encouraging users to inspect elements themselves for future tasks. However, baileysteelefarm clarified they wanted the button hidden only on the homepage, not globally. neounix advised identifying a unique CSS class on the homepage to scope the rule, while riking provided a specific example: body.navigation-topics, body.navigation-categories { #create-topic { ... } }. baileysteelefarm thanked the contributors for the helpful guidance.
I don’t know if there is a simple way to do it.
You may want to look at this in order to add a page-specific class to the page body: Address /latest differently then /new etc via CSS - #4 by Johani
And then, target the create button through this css class to hide it where you want.
You can add this to your theme CSS:
button#create-topic{
display:none;
}
Please note, for future reference, that you can simply right click on any item in a web page and select Inspect and a web developer window will appear where the element is highlighted.
Then, you can quickly see that the button element has the unique id, create-topic.
(So quickly in fact, that it takes less time to inspect the element, write and insert a few lines of CSS into your theme, than the time it takes to post a question in any forum and wait for a reply, thus saving you a lot of time and giving you the satisfaction of mastering these small tasks.)
With this information, you can easily create a selector in CSS:
button#create-topic
This CSS selector means (in a nutshell) “select the button element with unique id create-topic”.
After you select it, you can easily hide it, it change the color, font, size, etc. as you like.
button#create-topic{
display:none;
}
I appreciate the help, however that removes the new topic button from all pages. I want it removed from just the home page.
Then, I kindly suggest you go to your home page and look for a CSS element unique to that page and create your own CSS selector to change the element on that particular page.
That is why I took the time to describe to you, in some details, how to do it; so you can do it yourself.
… such as body.navigation-topics, body.navigation-categories { #create-topic { ... } }.
Thank you Kane, that was very helpful.
