# Wp-discourse-shortcodes plugin

**URL:** https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910
**Category:** Extras
**Created:** [20 augustus 2016 om 01:41 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910 "2016-08-20T01:41:38Z")
**Posts on this page:** 11
**Page:** 6

<div class="post-metadata">

### Author: ![kiefferr](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@kiefferr](https://meta.discourse.org/u/kiefferr)
#### Post date: [18 juli 2023 om 18:01 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910/109 "2023-07-18T18:01:10Z")

</div>

Also a bug with nested categories not displaying. Only topics within a primary category shows up.  
See ex below: General but no General \>\> News and Events

 ![image](https://global.discourse-cdn.com/meta/original/4X/2/0/9/2098cb4c568b1bca758b7e526a302ada7549080b.png)

and again with tiles and all other shortcode attributes removed..

 ![image](https://global.discourse-cdn.com/meta/original/4X/6/f/d/6fdcec7070dd2b93f4a8dd186875776e0914a767.png)

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [19 juli 2023 om 07:37 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910/110 "2023-07-19T07:37:00Z")

</div>

Hey Ryan, neither topic image previews or names are features of the plugin, however you can use these filters to apply your own formatting and to possibly add those elements in.

To override the HTML output entirely use these two filters (i.e. the add\_filter equivalents)

```plaintext
// Return false to use your own formatting
apply_filters( 'wpds_use_plugin_topiclist_formatting', true );

// Return your own HTML output from the discourse_topics data
apply_filters( 'wpds_after_topiclist_formatting', $output, $discourse_topics, $args );

```

Or add additional elements into the existing HTML

```plaintext
apply_filters( 'wpds_topiclist_above_header', $output, $topic, $category, $poster_avatar_url, $args );
apply_filters( 'wpds_topiclist_above_footer', $output, $topic, $category, $poster_avatar_url, $args );
apply_filters( 'wpds_topiclist_avatar', $avatar_image, esc_url_raw( $poster_avatar_url ) );
apply_filters( 'wpds_topiclist_below_footer', $output, $topic, $category, $args );

```

> [@kiefferr](#):
>
> Also a bug with nested categories not displaying. Only topics within a primary category shows up.

Sorry do you mean the topic from a nested category is displaying, but not its category badge?

---

<div class="post-metadata">

### Author: ![kiefferr](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@kiefferr](https://meta.discourse.org/u/kiefferr)
#### Post date: [19 juli 2023 om 12:51 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910/111 "2023-07-19T12:51:06Z")

</div>

Many thanks, Angus. That is helpful.

> [@angus](#):
>
> Sorry do you mean the topic from a nested category is displaying, but not its category badge?

Correct. If a topic resides in a nested category the badge will not display.. the screenshot below shows the missing badge. This is a topic within the General \>\> News and Events nested category. If I were to change the category of the topic to the parent ‘General’ category, the badge would display as the second topic below..

 ![image](https://global.discourse-cdn.com/meta/original/4X/b/5/8/b586ccb6a9e814db844a192eb2f88ebbc34eef54.png)

---

<div class="post-metadata">

### Author: ![angus](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/angus/32/341715_2.png) [@angus](https://meta.discourse.org/u/angus)
#### Post date: [21 juli 2023 om 15:14 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910/112 "2023-07-21T15:14:22Z")

</div>

Thanks for clarifying Ryan, I’ll take a look at that issue next week and get back to you.

---

<div class="post-metadata">

### Author: ![kiefferr](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@kiefferr](https://meta.discourse.org/u/kiefferr)
#### Post date: [21 juli 2023 om 16:09 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910/113 "2023-07-21T16:09:28Z")

</div>

Thanks. FWIW, I added a “real name” attribute to replace usernames and posted my changes within this repo.. I’m pretty new to git so I apologize it didn’t follow the proper commit channels, but the changes are there if ever helpful to anyone else..

[https://github.com/laikasport/wpds-shortcodes-w-user](https://github.com/laikasport/wpds-shortcodes-w-user)

 ![image](https://global.discourse-cdn.com/meta/original/4X/d/f/7/df7aeb7d8329fffd5466fc0c066ac3aa85cb3334.png)

---

<div class="post-metadata">

### Author: ![kiefferr](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@kiefferr](https://meta.discourse.org/u/kiefferr)
#### Post date: [22 augustus 2023 om 14:53 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910/114 "2023-08-22T14:53:55Z")

</div>

The big issue with this plugin still is the inabillity to include/exclude by category. In a private membership based forum you either see all the categories or you get none, which means there’s no way to exclude staff topics from being shown to the wider member base.

> [@RGJ](#):
>
> I still see one large issue where `[discourse_topics]` shortcodes with different categories do not work correctly. This will take quite an amount of work to fix. I will address that one first thing after my upcoming vacation.

However, it seems like an easy workaround could be commenting out the ajax request and relying exclusively on the webhook. We have triggers setup to exclude the staff category in the webhook..

 ![example](https://global.discourse-cdn.com/meta/original/4X/6/9/d/69d557f8e11d63a7b2ae600d3371b75307cb4cd3.png)

And this works to temporarily block new staff discussions until the ajax call is eventually made.

So maybe just comment out the ajax call?..

 ![image](https://global.discourse-cdn.com/meta/original/4X/f/4/9/f49c4106f233c4b37f0deaa59a3d30b9307cd8ae.png)

Am I overlooking something that would make this approach inadvisable?

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [23 oktober 2024 om 09:10 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910/116 "2024-10-23T09:10:39Z")

</div>

Revisiting

> [@kiefferr](#):
>
> The big issue with this plugin still is the inabillity to include/exclude by category.

> [@Kayla](#):
>
> I would like to show private topics, but only of certain categories (which are collected under a single parent category

> [@KlaasKoopman](#):
>
> Is it possible to get the topics from a certain category or subcategory only?

🎉 I am happy to announce that the [WP Discourse](https://github.com/discourse/wp-discourse) Shortcodes plugin now has support for the [(experimental) topic list filter feature](https://meta.discourse.org/t/experimental-topics-list-filter-feature/263641). 🎊

Next to `source="latest"` or `source="top"` you can now do `source="filter"` and put the filter query in the `q` parameter, like this

`[discourse_topics source="filter" q="category:general,site-feedback"]`

Don’t forget to enable the `experimental_topics_filter` setting first!

I’ve also fixed some bugs:

- completely reworked caching (this also removes the need to have an `id` attribute)
- usernames were not showing on non-English forums
- add category filter to latest-AJAX

The plugin is still not in the Wordpress plugin repository, so you should git clone it from the repo

```plaintext
cd wp-content/plugins
git clone https://github.com/communiteq/wp-discourse-shortcodes

```

or alternatively upload this ZIP file to install it.  
[wp-discourse-shortcodes-0.40.zip](https://meta.discourse.org/uploads/short-url/dwTJzRuFgYSMW2JO3x9MhiNVMz5.zip) (67.6 KB)

---

<div class="post-metadata">

### Author: ![jrgong](https://avatars.discourse-cdn.com/v4/letter/j/c57346/32.png) [@jrgong](https://meta.discourse.org/u/jrgong)
#### Post date: [25 oktober 2024 om 11:44 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910/117 "2024-10-25T11:44:11Z")

</div>

This is huge! Thx for the great work, that opens up a whole new set of possibilities ❤

---

<div class="post-metadata">

### Author: ![loup20](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/loup20/32/463457_2.png) [@loup20](https://meta.discourse.org/u/loup20)
#### Post date: [11 november 2024 om 13:41 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910/118 "2024-11-11T13:41:38Z")

</div>

Trying to follow along here, but can’t seem to find out if this is a current capability.

– I want to display RECENT POSTS across all/any category and topic. —

The info I’d want to display is:

- User name / Date Posted
- Title of Topics
- Title of Category
- Excerpt (45 characters)
- Likes (and maybe replies?)

Anyone know if this is possible?

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [11 november 2024 om 14:45 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910/119 "2024-11-11T14:45:42Z")

</div>

The plugin uses what is provided by Discourse so please continue that question in the topic of your other post [here](https://meta.discourse.org/t/experimental-topics-list-filter-feature/263641/60).

---

<div class="post-metadata">

### Author: ![kiefferr](https://avatars.discourse-cdn.com/v4/letter/k/a5b964/32.png) [@kiefferr](https://meta.discourse.org/u/kiefferr)
#### Post date: [23 oktober 2025 om 15:23 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910/120 "2025-10-23T15:23:47Z")

</div>

A little late to the party here, but thank you!

[Vorige pagina](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910.md?page=5)
