From this tutorial, you’ll learn how to add modules to the article using Joomla commands.
There are two features in Joomla that allow you to easily place modules directly inside articles:
- loadposition – allows you to publish all the modules in a particular position.
- loadmodule – allows you to publish just one particular module.
Let’s add a module with loadposition.
This command allows displaying all Joomla modules from a specified module position.
- Choose the needed module or add a new one.In Joomla admin panel, navigate to Extensions and click Modules. Create a new module, duplicate or use an existing one. Assign the module to some specific position. Note, that you can make up your own module position names and use them for this technique.Let’s create a new one. Open the module and in the Position field at the right side type your position name, for example, “new1”. Save your module.
- Then add a new article or use an existing one. Press “toggle” icon and switch editor to code mode. Choose where you want to place the module and type the following command:{loadposition new1}
Click on Save & Close.
- Refresh the article page to see the module is showing up. This command allows you to display several modules from the same position in one place in an article.
Let’s try a different method with loadmodule command.
The command looks like this:
{loadmodule mod_type, The module title}
Mod_type is a specific type of module, for example, mod_custom, menu. In order to check this value please check module folder name on FTP under “modules” directory in the root of your Joomla installation. The folder name is module type that you should use. For example: mod_custom, mod_menu, mod_feed, mod_finder, mod_swiper, mod_tm_facebook_page_plugin.
The module title is the original title of your module.
We are going to add “My social media” module to our article. Module type: mod_menu. Open needed article, press “toggle” icon and switch the editor to code mode. Put in this code:
{loadmodule mod_menu, My social media}
to the position of the article that you want it to show up.
Click Save and check your article. You should have “My social media” module there.