Despite being tremendously useful, template overrides for plugins are a type of override that is barely known in Joomla community.
There is no way to create this type of override from the Joomla backend. It is a completely manual process. Template overrides for plugins are intended for extensions that output content in frontend. This means just a few plugins are ready for this feature.
In this tutorial, we will show you how to easily create plugin overrides in Joomla.
The plugins that have a tmpl folder with the output files in there, are the ones that are ready for overrides. A good example is the page navigation plugin, that prints the “prev” and “next” links in a single article.
Step #1. Create the plugin override
Let’s create a plugin override taking as an example the Page Navigation plugin for articles.
- Go to: plugins / content / pagenavigation / tmpl folder
- Copy the file default.php
- Paste default.php in a new location inside your template’s folder in: templates / your-template / html / plg_content_pagenavigation
The folder name "plg_content_pagenavigation" is the result of this structure: "plg_PluginType_PluginName".
- PluginType = content
- PluginName = pagenavigation
If you are creating an override for another plugin, follow the same pattern to name the folder within your template.
Step #2. Customize the plugin override
- Edit the file default.php you just copied. Change the HTML according to your needs.
In my case, I changed the html that rendered the navigation links. Instead, I gave them the aspect of buttons with more color.
Step #3. Check the end result
- This if how the default page navigation links look in Protostar template:
- After my customizations, this is the end result: