Alternate New Topic Button (per category)

:information_source: Summary Changes the text of the New Topic button per category.
:hammer_and_wrench: Repository github.com/nathan-nz/category-new-topic-button
:question: Install Guide How to install a theme or theme component
:open_book: New to Discourse Themes? Beginner’s guide to using Discourse Themes

Install this theme component

This theme component allows you to customise the “Create Topic” button label in Discourse for specific categories, for the specific use case of dedicated Events categories.

It can easily be forked and modified for other use cases; it wasn’t practical to make this configurable.

How It Works

This component leverages Discourse’s API to override the default “Create Topic” button label based on category-specific needs. It allows admins to control which categories display custom labels and what that label should be.

Configuration and Settings

  • Settings Options:

    • Category Event Labels: A setting allows administrators to pick specific categories that should use the new_event translation (“New Event” by default).
    • Default Behaviour: For categories not specified in the settings, the button will default to displaying the new_topic translation (“New Topic” by default).
  • How to Configure:

    1. Access Settings: Navigate to the theme settings section in your Discourse admin panel.
    2. Select Categories: Use the category picker under the “Category Event Labels” setting to select categories you want labelled as “New Event.”
    3. Save and Update: After making selections, save your changes to apply the new button labels instantly.

This component is designed to be simple yet powerful, giving you the flexibility to either apply uniform or categorised customisation to your forum’s interface.

4 Likes

How does this compare to the Customize new topic button text theme component?

4 Likes

Ha! I completely missed that TC and got lost in several older threads that clearly haven’t been tied together. I’ll get onto that!

This TC simply changes the text, rather than hiding the default button and replacing it with a new button. For my use case where I’m also routing to a Wizard from the Custom Wizard Plugin 🧙, this is necessary.

However, I’m impressed by the completeness of Customize new topic button text (settings array, covers other buttons, etc) and on looking at it again I see it is possible to change the route of the new button with a small tweak. It would be better to (slightly) extend that TC instead of having this one.

I’ve put in a Feature for this, including a pull request:

3 Likes