XF 2.2 How to customize the sub-forums dropdown phrase for different categories?

tomwood

Member
Licensed customer
Hello,

I customized the 'sub_forums' Phrase text to read 'List' because that better matches the situation.

That works, but it could be a little clearer if I could customize it for particular Categories. I know they are using the same Template, so I was wondering if there is some sort of if-then statement that could be inserted in the appropriate template to get it to select a different Phrase for specific Categories while leaving the default in place for all the others.

list.webp

Thanks!
 
The sub_forums phrase is global, so editing it changes the text everywhere. To show different text for specific categories, you'll need a template modification with a conditional.

Create a template modification targeting the node_list_forum_level_2 template (or forum_list_sub_forums depending on your XF version). Use the category's node ID to conditionally swap the phrase:

Code:
<xf:if is="$category.node_id == 5">
  Browse ▼
<xf:elseif is="$category.node_id == 12" />
  Sections ▼
<xf:else />
  {{ phrase('sub_forums') }} ▼
</xf:if>

Replace 5 and 12 with your actual category node IDs. You can find those in Admin Panel > Setup > Nodes — the ID column shows each node's numeric ID.

To set this up as a template modification:

1. Go to Admin Panel > Appearance > Template modifications
2. Create a new modification
3. Template: search for the template that contains the sub_forums phrase rendering (inspect the "List" dropdown in your browser to find the exact template)
4. Find: the phrase call {{ phrase('sub_forums') }}
5. Replace: with the conditional block above

The <xf:else /> fallback ensures all other categories still show the default phrase text, so nothing else changes.
 
Back
Top Bottom