Announcing WordPress plugin to display any data from Discourse


(Anton) #1

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.


Plugin for embedding Discourse topics in wordpress pages or posts
Releasing "Twig Anything" v1.2 - display any Discourse data anywhere in WordPress
How to embed full topic list (i.e., my main Discourse page) on WP site?
"Recently joined" widget for WordPress (Illustrated Tutorial)
Display Data Explorer query results in WordPress (with TwigAnything)
WordPress Plugin Question - Widget for Home Page?
(Anton) #4

Version 1.6.2

A minor update was released today - version 1.6.2.

2 more functions were made available in Twig Templates:

  • get_post_meta - utilizes the native WordPress function with the same name
  • get_current_post_meta - the same but does not require you to pass the post ID as its first parameter, and instead uses the ID of the current post in the WP loop.

A real use-case utilizing the new plugin feature with a step-by-step tutorial can be found here:

http://forum.twiganything.com/t/add-existing-discourse-topic-to-a-wordpress-post-with-twiganything/27

The main point of the tutorial is the ability to dynamically build URL to query Discourse for comments based on a topic ID, which can be stored in a custom post field and retrieved by the get_current_post_meta function, see the Data URL field:


(Anton) #5

Version 1.6.3

Another update is here, which gives birth to endless WordPress/Discourse integration options, thanks to the Data Explorer plugin.

See a tutorial which goes through all steps in one interesting use-case:

2 main updates in this version:

  • Add GET/POST selector to URL Data Source
  • Update React.js library to version 0.14.7


(Joel Zaslofsky) #6

Are you still actively developing and supporting this plugin, @meglio? If so, I’d consider using it for an upcoming WordPress/Discourse combined platform that my community is starting to develop.


(Anton) #7

Yes I do support, and I use the plugin for my own WP/Discourse integration.
Other live websites are also using this plugin. For example, pyxeldynamo.
Not actively developing new features right now, but it is stable and does what it claims to very well.


(Anton) #9

Version 1.6.5

I’ve been successfully using Twig Anything for more than 2 years now to let our complementary WordPress website (kozovod.com) show various data from our Discourse instance (forum.kozovod.com).

More than 100 websites started using the plugin since the very first release.

It’s time to make a maintenance and stability improvement release. Version 1.6.5 is now available:

Please note that there is no v. 1.6.4. The previous version is 1.6.3

It brings no new functionality to the plugin, yet existing customers are encouraged to update in order for the plugin admin area to work in the latest Google Chrome browser and with other WordPress plugins / themes that use the same libraries behind the scenes, like e.g. Avada theme.

Here is the full list of updates:

  • Update CodeMirror library to v. 5.32.0
    (the existing bundle stopped working
    for the latest Google Chrome browser version)

  • Wrap CodeMirror library to prevent conflicts with CodeMirror instances
    loaded by other WordPress plugins or themes

  • Toggle CodeMirror full screen mode by Ctrl-Enter rather than F11
    (F11 has a different purpose in MacOs)

  • Use Clipboard.js library instead of unsupported and outdated ZeroClipboard

After logging into your account at Twig Anything website, download the latest version from Download your Twig Anything plugin – Twig Anything. The price has also been increased to $59 to better reflect the time spent on the support.

Also, here is a new tutorial on how to display a newly registered Discourse users in WordPress, like this: