How To View Template Code In Joomla 4

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:

Site module in home dashboard with no template code icon

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:

  1. Log into the Joomla admin area
  2. Navigate to the Site module
  3. Click the gears icon
  4. Click Edit in the dropdown
  5. Scroll down to the Template Code Icon button and turn it to Show
  6. Click Save or Save & Close

Now, returning to the site menu, you will see the template code button:

Site module with template code icon in home dashboard

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.

The template code editor

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:

Broken Joomla site
CM
Christopher Maiorana Content Writer II

Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.

More Articles by Christopher

Was this article helpful? Join the conversation!

Questions about our MailChannels Deployment? We have answers and are here to help!Learn More
+