Releasing "Twig Anything" v1.2 - display any Discourse data anywhere in WordPress


(Anton) #1

New version 1.2 of Twig Anything arrives!
(read the original announce topic).

Twig Anything is a WordPress plugin that lets you fetch any data from Discourse and display it anywhere in your WordPress blog with using shortcodes. See a nice demo and an illustrated step-by-step tutorial.

New Features in v1.2

:one: Official Visual Composer support

Visual Composer is a popular plugin that simplifies building complex layouts for your WordPress blogs and posts. A lot of plugins tend to play well with it. And so does Twig Anything!

In the Visual Composer editor, you will find a new block named “Twig Anything Template”. See demo


:two: Intelligent handling of data retrieval and parsing errors

From now on, you can control what to do if there has been a failure while fetching or parsing data. You have one of 3 options to choose from:

  • use cache or display nothing - will try using data from out-of-date cache if it exists, otherwise display nothing (an empty string); in other words, if error will be thrown while retrieving data, an old data from cache will be used, if available, otherwise nothing will be shown. This can can happen, for example, if Discourse server is unavailable because it’s restarting after upgrade.
  • use cache or display error - will try using data from out-of-date cache if it exists, otherwise display an error message
  • always display error - always display an error message - might be useful while you are developing your website and there are very occasional visitors yet.


:three: Intelligent preview mode

As you know, you can preview any post before you publish it by clicking the standard WordPress’ preview change button:

With Twig Anything, you can preview your templates the same way. In the preview mode, a special notice is shown, and only under it comes the rendered template:

As you can see from this screenshot, in the preview mode, any errors are always displayed, and the data is always retrieved from the data source and never from the cache.


Thanks for your interest!

  • Ask me any questions in this thread

  • Access plugin from the twiganything.com website


"Recently joined" widget for WordPress (Illustrated Tutorial)
Could I show the best posts in a seperate view like WordPress?
PAID Seeking discourse developer for user card/user profile customizations
(Erlend Sogge Heggen) #2

This plugin has great add-on potential. Have you considered adopting the business model of EDD and WooCommerce? i.e. give away core plugin for free, while selling handy add-ons (Discourse integration, Visual Composer integration etc.) separately?


(Anton) #3

Have been thinking about it a lot.

There are 2 issues with this model:

  1. The most valuable and complex part in the terms of development is the core plugin, while data formats and data sources are pretty easy to add.
  2. Not sure if there will be a lot of interest in this plugin - just testing the market. Yet I guess the popularity may increase steadily if I add more sources and formats with time. I love the plugin and use it myself intensively and find it very useful - so far that being the main reason why I make it available publicly.

Should I probably try it vice-versa - i.e. have the core plugin and only complex add-ons sold, while all other simple add-ons made free in the official WordPress plugins directory? I might add some good extensibility points and release e.g. CSV format as a free add-on to start with. Or would you propose another ideas?

Re developing a Discourse API add-on - yes, that sounds great. I just can’t find enough useful use-cases where a standard HTTP JSON would not be enough. Do you have anything particular in mind?


(Erlend Sogge Heggen) #4

I’m no expert and I’m not (-yet, though I can think of some ways I might use this) a Twig Anything user, but there are some obvious benefits to having an open source core:

  • You’d get to be on the official WP plugin repo

  • You could keep your code on GitHub (see Ship)

  • Being open source would make it easier to become friendly with the Twig community (but seriously, where’s the Twig community at? I can’t find it)

  • Similarly, you might get friendly with other Twig-WordPress related projects, like Timber.

  • Being (partially) open source also increases your chances of being showcased in places like wptavern.com (though you should contact them regardless, they’re great).


(Anton) #5

Thanks for linking to Ship - quite an interesting service. Unfortunately, they don’t support the recommended WordPress SVN pattern, which implies placing screenshots in /assets instead of /trunk.


Re being on the official WP plugin repo - yes, that would be nice!
I’ll be still thinking about the best model and experimenting.

So far I got the free CSV format add-on approved (demo), so it is now available in the WP plugins directory:

The complementary Twig Anything plugin v1.3 has been released as well, the main new feature being extensibility points for custom formats and data sources. So now anyone can try creating their own advanced Discourse add-on (still have to document the hooks introduced).