Categories

Filter threads by prefix menu

You are here:
< All Topics

This will give you a prefix menu above the thread list which filters threads by prefix. (Much more obvious and intuitive than the existing Filter by prefix)

Here’s one I made earlier:

You can do this via a template modification or just customise the template itself.

  • Make a note of the prefix names and IDs (you can see the ID number in the URL of the main Thread Prefixes list – click on the prefix and note the number at the end. Alternatively click on the prefix in the thread list.
  • Make a note of the forum URL when NOT filtered by any prefix. This is for the initial All menu item to quickly get back to unfiltered.
  • Make a note of the forum ID (the number at the end of the forum URL)
  • Add the code below to the top of the template forum_view (capitalised text to be replaced, they are instructions what to insert in the code)

First we need to make sure this only appears in the forum we want (you can do this for as many forums as you want). In this case the forum ID is 68

Step A:

Code:

<div style="margin-bottom:10px">
<xf:if is="{$forum.node_id} == 68">
<span class="">Filter by Prefix:</span>
<a href="INSERT FORUM URL HERE">
<span class="label label--red">All</span></a>
    CODE FOR STEP B WILL BE INSERTED HERE
        </xf:if>
</div>

Then we add the different prefixes as menu items. Obviously you can choose your preference of color. Insert the step B code into the above

Step B:

Code:

<a class="labelLink" href="?prefix_id=1">
<span class="label label--red">Name of Prefix 1</span></a>
    <a class="labelLink" href="?prefix_id=2">
<span class="label label--red">Name of Prefix 2</span></a>
    <a class="labelLink" href="?prefix_id=3">
<span class="label label--red">Name of Prefix 3</span></a>

ADD AS MANY PREFIXES AS YOU HAVE FOR THAT FORUM

You can obviously style your div (e.g. add a class to extra.less) or <span>Filter by Prefix:</span> span to suit.

Table of Contents