Joomla templates, plus modules you can publish, make up the look, feel, and function of your site. But what if you want to edit the actual template code to do things outside of the scope of what comes with the template itself? With a note of caution, it’s easy to edit your template, as long as you know what you are doing.
Editing template code can be destructive to your site. Make sure you have received explicit instruction and have a solid backup of your site — just in case.
In this article, you will learn how to add a button to the home dashboard that will allow you to quickly and easily view and edit template code.
The site menu without the template code button:
How To Add the Template Code Button To Home Dashboard
Follow the steps below to add the template code button to the home dashboard in Joomla 4:
- Log into the Joomla admin area
- Navigate to the Site module
- Click the gears icon
- Click Edit in the dropdown
- Scroll down to the Template Code Icon button and turn it to Show
- Click Save or Save & Close
Now, returning to the site menu, you will see the template code button:
Now you can quickly access template code and make changes.
Some Notes About Editing Code
Any time that you are editing the code of your template you must be careful and make sure you know exactly what line of code you want to change and how that line affects other files. Joomla runs on the PHP scripting language which, like many other languages, relies upon file includes to pull different content into other files. So in addition to editing one file you might be unintentionally affecting how other aspects of the template work together.
If your edit breaks the site, Joomla will not warn you. This means you could edit one file and reload your page to find your site looking like this: