Finally, a universal WordPress plugin that fetches anything from Discourse and outputs it in your blog.
Dear Discourse community!
I have been using Discourse for almost 2 years, mostly combining it with WordPress.
As a result, I ended up creating a WordPress plugin that lets me display any JSON data with using an easy to learn Twig syntax.
Recently, I put some effort to teach the plugin fetching data from WordPress’ underlying MySQL database and use the same Twig syntax to output the data fetched.
These two features combined so well and covered so many cases that I decided to put some effort to polish it, create a tiny website and make it available on the marketplace.
###Please welcome - Twig Anything plugin for Wordpress + Discourse and much more
Example 1. Top 5 most liked users this week
Example 2. Howto topics discussed now:
Example 3. Latest topics from a particular category (in Russian) - see it live
Example 4. Forums leaderboard with various statistics (in Russian) - see it live
How it works
Firstly, the plugin adds Twig Templates
section to your WordPress:
Next, for every template, you configure what data you want to fetch from Discourse and whether to cache it and for how long:
Finally, you create a simple HTML template with Twig syntax. you have full control of how the data is displayed. Here is a simple example of how it looks in WordPress:
Twig can do many things for you: filter and slice arrays, transform strings, call some PHP functions safely and much more. That’s why I selected Twig to display the data.
When you have finished creating your Twig Template and is happy with the output (by clicking the Preview button), you can now copy the shortcode and use it anywhere in WordPress: in posts, pages, headers, footers, widgets etc:
Tutorial and more demos
Here are a few demos showing real live data from Discourse Meta.
Here is an illustrated step-by-step guide for retrieving data from Discourse and displaying it in WordPress.
How to get the plugin
The plugin is not free, but it is not expensive either - just $37 for a single WordPress setup (multisite included). This includes:
- unlimited use with a single WordPress installation
- full source code
- 1 year free updates
- 3 months support
P.S. I’m very confident regarding the price - the high quality code is covered by my 10+ years experience developing in PHP, including for WordPress. I know how the high quality plugin can make the difference. So if you need the plugin, I’m asking you to appreciate my effort and accuracy and love that I put into it. Buying the plugin will also help me to evolve it further based on the feature requests of the community.
Your feedback and feature requests
For Discourse users, I’d happily answer and questions and take any feature requests right in this thread. Otherwise, you’ll find a simple support system right on the website.
Afterword
I’m very interested in what community thinks of this plugin, how you would use it and on which website. Please let me know! I can’t wait seeing it in action. After all, there have been no complete JSON-rendering plugins for WordPress - before today, and that’s why I made it.