Joomla module is a block of code that displays the data on the page. Joomla provides a facility to add modules on the positions that are defined in the template. In this article, we will learn how to use Joomla module positions in Joomla 4.
Sometimes we need to add a module where template positions are not placed on the page. If you want to add a module within the article where Joomla template positions are not available.
There are two ways in Joomla that allow easy place directly.
- loadposition – Publish module by specific position
- loadmodule – Publish module by specific module name
Let See: How to connect Joomla with an SQL Server?
Step1: Enable the Load Module Plugin
Before applying both methods we need to enable the load module plugin from the plugins manager.
- Go to Extensions=>Plugins
- Find the “Content – Load Modules” plugin using the filter.
- Make sure the “Status” column has a green check in it. If it’s a red circle, click it to make it green.
Step2: Add module by Module Button
- In the article using a text editor you can see a Module button on the right side, So click on it.
module button
- Click on the green module button which one you want to publish in the article.
This module will display the all latest articles (news) using the loadmodule_id as below-
{loadmoduleid 28}
Step3: Add Module using {loadmodule} and {loadpostion}
Let See: How to update Joomla to latest version
Let me explain both methods in detail below.
- loadmodule– There are the following steps:
- Create an article
- Write the name of the module (ex. login module) with the prefix “mod_” like mod_login
- Syntax: {loadmodule mod_login}
After saving this article, It will look like this at the front end:
- loadposition– If you want to add a module in the article you have to use {loadpostion position_name} syntax in the article. It provides more control over the module syntax and it is useful if you are not using the Joomla editor.
- Go to extensions >> Module Manager > New
- Select a module type like “Book Store”
- Enter the title of the module
- On the right side of the screen select the position example “position-10”
- Save your module
After saving the module and entering syntax in the article as below-
Let See: How to install Joomla template on Server
After saving the article it will look like this on the front end