# Custom Topic Sort Order Button

**URL:** https://meta.discourse.org/t/custom-topic-sort-order-button/380530
**Category:** Theme component
**Created:** [August 27, 2025, 1:52pm UTC](https://meta.discourse.org/t/custom-topic-sort-order-button/380530 "2025-08-27T13:52:44Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [August 27, 2025, 1:52pm UTC](https://meta.discourse.org/t/custom-topic-sort-order-button/380530/1 "2025-08-27T13:52:44Z")

</div>

| | | |
| --- | --- | --- |
| ℹ | **Summary** | Topic Sort Order Button |
| 👓 | **Preview** | [Theme Creator](https://discourse.theme-creator.io/theme/Don/topic-sort-order-button) |
| 🛠 | **Repository** | [GitHub - VaperinaDEV/custom-topic-sort-order-button: Add a custom topic sorting button to the topic list. · GitHub](https://github.com/VaperinaDEV/custom-topic-sort-order-button) |
| ❓ | **Install Guide** | [How to install a theme or theme component](https://meta.discourse.org/t/how-do-i-install-a-theme-or-theme-component/63682) |
| 📖 | **New to Discourse Themes?** | [Beginner’s guide to using Discourse Themes](https://meta.discourse.org/t/beginners-guide-to-using-discourse-themes/91966) |

Install this theme component

Hello 👋

This theme component adds a new button next to the **Create Topic** button, allowing you to change the topic list order. One of the main goals was to make topic ordering easily accessible on mobile devices as well and themes where the topic list header section is hidden.

 ![Screenshot 2025-08-27 at 13.44.08](https://global.discourse-cdn.com/meta/original/4X/e/d/5/ed5d5be6794c1b891365dcb001bf9d19de9c72c0.png)

Clicking on an item will show the sort order direction (ascending or descending) on the right side of the item.

| Descending (icon) | Ascending (icon) |
| --- | --- |
| ![Descending](https://global.discourse-cdn.com/meta/original/4X/8/c/0/8c0414d49113640cf938f8bbee3fb8d8856d5136.png) | ![Ascending](https://global.discourse-cdn.com/meta/original/4X/d/5/b/d5b2df8c4aff325a42c18a86ccfe094db3b5cb0e.png) |

### Settings

This component contains several settings for customization.

 ![Screenshot 2025-08-27 at 13.45.14](https://global.discourse-cdn.com/meta/original/4X/3/3/2/332dabf7584dcb3a63c755b6264c83d04328886c.png)

#### Object setting

With the object setting you can change each item’s **icon** , **label** , **action** and **order**.

 ![setting page](https://global.discourse-cdn.com/meta/original/4X/0/4/5/0452929b7976dbb4abc896a3a8a440190a08f97d.png)

- **icon** → icon name from the Discourse icon set
- **label** → translation key (see `/admin/customize/site_texts`)
- **action** → sorting action identifier
- **order** → position of the item in the dropdown

Example for `label`:

![likes-label](https://global.discourse-cdn.com/meta/original/4X/5/0/7/5070a78a266a94bc7a4ea14f8dc4bbe9dff80730.png)

In this case the label field should be: `js.likes`

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [August 27, 2025, 2:24pm UTC](https://meta.discourse.org/t/custom-topic-sort-order-button/380530/2 "2025-08-27T14:24:12Z")

</div>

Great component! I thought about creating something similar.

I noticed you did not add a license to the GitHub repo.

Would you accept a pull request that adds more order options like `op_likes`?

> <https://github.com/discourse/discourse/blob/3e0dff8ee9c1ec713203a57a461f5402ffbadba5/lib/topic_query.rb#L105-L113>

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [August 27, 2025, 2:35pm UTC](https://meta.discourse.org/t/custom-topic-sort-order-button/380530/3 "2025-08-27T14:35:32Z")

</div>

this is a great component Don, nice work! thanks for creating this 🤩

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [August 27, 2025, 2:36pm UTC](https://meta.discourse.org/t/custom-topic-sort-order-button/380530/4 "2025-08-27T14:36:59Z")

</div>

Sure! PR welcome thanks @Moin 🤗

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [August 27, 2025, 2:42pm UTC](https://meta.discourse.org/t/custom-topic-sort-order-button/380530/5 "2025-08-27T14:42:23Z")

</div>

One thing I noted is that I sort of expect the drop down to disappear after I’ve clicked one of the selections. I have to click outside it after the view changes to make it go away. But maybe that is by design - I’m not sure lol.

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [August 27, 2025, 2:48pm UTC](https://meta.discourse.org/t/custom-topic-sort-order-button/380530/7 "2025-08-27T14:48:23Z")

</div>

Yeah this is by design — if you click the same item again the sorting direction changes.

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [August 27, 2025, 2:49pm UTC](https://meta.discourse.org/t/custom-topic-sort-order-button/380530/8 "2025-08-27T14:49:22Z")

</div>

yea i was thinking that after playing with it more. i love this component - very useful for me on my own instance. thanks again 🤗

---

<div class="post-metadata">

### Author: ![Lilly](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/lilly/32/575047_2.png) [@Lilly](https://meta.discourse.org/u/Lilly)
#### Post date: [August 27, 2025, 2:54pm UTC](https://meta.discourse.org/t/custom-topic-sort-order-button/380530/9 "2025-08-27T14:54:36Z")

</div>

I notice the `sort by` button appears on the categories page, but doesn’t do anything there. could probably hide it in that case.

---

<div class="post-metadata">

### Author: ![Don](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/don/32/228726_2.png) [@Don](https://meta.discourse.org/u/Don)
#### Post date: [August 27, 2025, 3:29pm UTC](https://meta.discourse.org/t/custom-topic-sort-order-button/380530/10 "2025-08-27T15:29:01Z")

</div>

Thanks Lilly 🤗 I’ve merged it: [DEV: Remove sort button on categories page · VaperinaDEV/custom-topic-sort-order-button@1325272 · GitHub](https://github.com/VaperinaDEV/custom-topic-sort-order-button/commit/1325272b827fb1572adcfbe01662d2cac4fef962)

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [September 8, 2025, 12:24pm UTC](https://meta.discourse.org/t/custom-topic-sort-order-button/380530/11 "2025-09-08T12:24:53Z")

</div>

It’s merged.

 ![Screenshot_20250908_142040_Firefox](https://global.discourse-cdn.com/meta/original/4X/0/c/1/0c1bbfc39d1b612c298a73fdb32b28a76be51f71.jpeg)

> **Icons and labels I chose for the additional order options**
>
> ```plaintext
> {
> "icon": "custom-heart-circle-one",
> "label": "js.category.sort_options.op_likes",
> "action": "op_likes"
> },
> {
> "icon": "user-group",
> "label": "js.posters",
> "action": "posters"
> },
> {
> "icon": "far-square",
> "label": "js.category.sort_options.category",
> "action": "category"
> },
> {
> "icon": "square-plus",
> "label": "js.topic_voting.vote_title_plural",
> "action": "votes"
> }
> 
> ```

I did not add these to the default configuration as I think these are less common. But when you add them, you can now also order by likes on the first post, number of posters, category ID, and by number of votes when the topic voting plugin is used.

I created an icon for likes on OP so you can distinguish between likes and likes on the first post even when labels are hidden on mobile.

---

<div class="post-metadata">

### Author: ![eisammy](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eisammy/32/528804_2.png) [@eisammy](https://meta.discourse.org/u/eisammy)
#### Post date: [September 12, 2025, 2:10pm UTC](https://meta.discourse.org/t/custom-topic-sort-order-button/380530/13 "2025-09-12T14:10:28Z")

</div>

at mobile when I choose a option this modal move to top until dom loaded  
It’s a UI bug?
