A lot of Joomla sites start with a template that’s close but not quite right. You want a different header, one more module position or a tidier article layout. So you open the template files and start editing, and it all works fine until the template or Joomla itself gets updated and your changes disappear.
Joomla has two safer ways to do this. Layout overrides change how a module, component or layout displays its output, and child templates let you change a template while the parent stays as it is. Between the two, your design work stays separate from code someone else looks after.
Why hand editing bites you later
A template is a bunch of files someone else wrote and will keep improving. When the developer puts out a new version, the installer swaps those files for fresh copies, and any line you changed by hand is gone. Core Joomla files are the same, they get replaced during upgrades.
The Joomla documentation makes this point about the small layout files called JLayouts. It says not to edit them directly because your changes would be overwritten during any core upgrade, and recommends copying the file into your own template and editing the copy instead. That’s really the idea behind both overrides and child templates.
There’s a practical upside as well. When your changes sit in their own files, you can see exactly what’s been customised, and a new developer picking up the site can find the custom work quickly. Visitors never see that side of it, but a clean setup behind the scenes is part of good modern business website design all the same.
Overrides
An override is a copy of an output file that you put inside your template and then edit. Joomla uses that copy to display the matching module, component or layout on pages that use the template. The original file stays where it always was, untouched, and you only copy the bits you want to change.
The copies go in a folder called html inside the template. According to the Joomla documentation on layout overrides, a module override goes somewhere like templates/yourtemplate/html/mod_login/. A component view follows the same pattern, for example templates/yourtemplate/html/com_content/article/. Small JLayouts go in templates/yourtemplate/html/layouts/, which mirrors the core layouts folder.
Only copy the files you need. The documentation says copying everything just adds clutter, which it calls site bloat. A small set of overrides is a lot easier to check after each upgrade, because if a core layout changes in a later version, you’ve only got a handful of files to compare.
You don’t need to be a PHP expert for most of this, since a lot of overrides are small changes to markup and basic HTML gets you a long way. But override files are PHP files, so be careful. Change one thing, test it, then move on to the next.
Alternative layouts are a close relative. A standard module override applies everywhere that module shows up on your template. An alternative module layout only runs when you pick it in the module settings, so you can style one module differently and leave the others alone. The documentation notes that alternative module layout file names can’t contain underscores. It also warns that it’s up to the administrator to check the layout works on every template where the module appears. For component and category layouts, a menu item setting takes priority, because the most specific setting wins. Jot down which layouts you’ve assigned where, so they’re easy to find later.
Child templates
Overrides deal with the output from modules and components. A child template deals with the template itself. It builds on a parent and uses all the parent’s files except any files with the same name that you put in the child. So you only add what you want to change.
The Joomla documentation on child templates uses Cassiopeia as the example parent, and it sits in the Joomla 4 section of the docs. Templates from other developers may work differently, so check your template’s notes or ask the developer before you build on one. A new child starts with a single file, templateDetails.xml, which you can edit to change settings like template positions. From there you can add your own CSS file, or an index.php file to add extra module positions.
The documentation also says child template files aren’t affected by Joomla updates. Because the child only holds your changes, the parent can still be updated as normal, and any files you haven’t replaced keep coming from the parent. You still get the developer’s fixes and your own work stays where it is. That’s also why the child template is the better home for your overrides. If they’re sitting inside a third party template that you later update, they could get replaced.
The steps in the documentation are short:
- Go to System, then Site Templates, and open the parent template.
- Choose Create Child Template, fill in the dialog and confirm.
- Close the parent and open the new child, which is where your custom files will go.
- For custom styles, choose New File, pick the css folder and name the file user with the css file type. Add your styles, then save and close.
- Create a menu item that uses the child template style so your pages pick it up.
You can rename the style in Site Template Styles too, so it’s easy to spot in the list.
Before and after
Plan a bit first and you’ll save yourself redoing things. Write down the changes you want and sort them by where they belong. Colours, fonts and spacing usually go in a CSS file such as user.css in the child template, and they don’t need an override at all. Changes to the HTML a module, component or article actually prints go in an override.
Think about the visitor before you think about the code. Changes that make pages quicker to read, easier to scan or clearer about what to do next tend to pay off. Our guide to web design improvements that boost sales covers the sort of changes to do first, and it makes sense to start with the ones that touch the most pages.
Try everything on a copy of the site before you touch the live one. Some hosts give you a staging copy, and decent Joomla hosting makes that easier. Check the pages on a phone and on a desktop after each change, and keep a simple log of every file you added and why.
Overrides and child templates protect your changes, but they’re not set and forget. When Joomla or the parent template updates, the original files you copied might change, and your override hangs onto the old version, so it can miss a fix or a new feature. After a major upgrade, go through your override folder one file at a time, compare each one with the current original and copy across anything new that matters. Then check the pages that use it on your test copy. If that all sounds like more than you want to take on, our tips on finding the best web design services can help you find someone to do it.