# Wp-discourse-shortcodes 插件

**URL:** https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910
**Category:** Extras
**Created:** [2016年八月20日 01:41 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910 "2016-08-20T01:41:38Z")
**Posts on this page:** 1
**Showing post:** 40

<div class="post-metadata">

### Author: ![simon](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon/32/339122_2.png) [@simon](https://meta.discourse.org/u/simon)
#### Post date: [2017年九月10日 09:04 UTC](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910/40 "2017-09-10T09:04:43Z")

</div>

I’ve done some work on the discourse\_latest shortcode. It’s now called `discourse_topics`. You can specify which topic list you want with a shortcode attribute. It currently has `/latest` and `/top(daily|monthly|quarterly...)` routes. I’ll add a categories route soon. An excerpt can be added to each topic by giving a value to the `excerpt_length` attribute. If you give it the value ‘full’, it will display the full posts. The data and assembled HTML is cached. You can specify the `cache_duration` for each shortcode. An optional webhook can be used to break the cache for the `/latest` route. There’s an option for updating the latest route with ajax.

The position of the category badge, avatar, username, and date can all be set with shortcode attributes. A category class is added to each list item that can be used for styling. The plugin comes with some optional styles. If they are used, adding a `tile=true` attribute to the shortcode gives a basic tile layout. The size and spacing of the tiles can be altered by adding some css. Overflowing text in the tiles is truncated with javascript.

 ![30](https://global.discourse-cdn.com/meta/original/3X/f/7/f7f5e71e7172185123ded5139cc0a9419057e8bd.png)

 ![58](https://global.discourse-cdn.com/meta/original/3X/8/b/8bd5639e4a3884c3ab82a353e0aadb862b25e59e.png)

 ![02](https://global.discourse-cdn.com/meta/original/3X/7/7/770d074839a56caf88e4e60d64dc5445a074eee3.png)

I’ve also added an RSS shortcode that does basically the same thing, but displays less information. I’m not sure that it’s going to make it into the final version of the plugin.

The code is here [GitHub - communiteq/wp-discourse-shortcodes: Extends the wp-discourse plugin by adding shortcodes that can be used to link to the Discourse forum. · GitHub](https://github.com/scossar/wp-discourse-shortcodes). There’s a messy live demo here [https://testeleven.com/](https://testeleven.com/). I’ll be working on it some more this week, and also writing some documentation. If anyone would like to try it out in the meantime, bug reports would be greatly appreciated.

---

_[View the full topic](https://meta.discourse.org/t/wp-discourse-shortcodes-plugin/48910)._
