Shortcodes in Joomla Modules

A recent ticket prompted me to write this quick article because I'd forgotten the details and had to relearn them myself.


Jomres Shortcodes are a relatively new (4 or 5 years) addition to Jomres, however the technology underpinning them is a lot older. In fact Shortcodes are an evolution of a feature called "Asamodule" which is used to pull discreet sections of Jomres output into a Joomla page.

In recent years I've found Jomres Shortcodes so easy to work with that Asamodule itself has been largely forgotten, mainly because the Shortcode term is better understood by both Joomla and Wordpress users. Shortcodes make it so that I can write one set of code that produces X output, and you get the same results in both Wordpress and Joomla, so when a Joomla user asked how to use the new Search Widget plugin with Asamodule I immediately asked "Why not do it as a Shortcode?" to which they replied "How?" (I'm paraphrasing).

I tried it locally to make sure I wasn't handing out bad advice and it turns out that I'd forgotten a key ingredient of the receipe. The shortcode wasn't being rendered by the Joomla content modules. I had to have a dig on the 'net to refresh my memory.

A search term I used, which I expected results from and didn't get any was "Joomla plugin in module" so I'm going to put this here in case anybody else tries the same search as I did.

How to run a Joomla Plugin in a Joomla Module

Once you know, you'll kick yourself. It's ludicrously simple.

To start with, I tested a shortcode in an article and attached that article to a menu, just to make sure it looked right.

{jomres search_widget &search_widget=vertical_dates_sleeps}

The equivalent Wordpress shortcode would be [jomres task="search_widget" params=&search_widget=vertical_dates_sleeps]

Next I created a Joomla Module, and set the type to Custom.

I entered the same shortcode in the module's wysiwyg editor area, set the module position and then in the Options tab (Module/Menu assignment/Options/Advanced/Permissions) I neeeded to set the Prepare Content setting to Yes. Once you do that the module's content is passed through the Joomla content plugins, which is what we want.

Save the module, and that should be all you need to do. The shortcode content should appear in the module.