Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124
Physical Address
304 North Cardinal St.
Dorchester Center, MA 02124

In Joomla, a template override is a mechanism that lets us replace or extend the default markup generated by an extension without touching its core files. Think of it as a mirror that reflects the original output, but with the ability to change the reflection to suit our design or functional requirements. By placing a copy of a component, module, or plugin view inside the template’s html folder, Joomla will render our version first, and only fall back to the original if our file is missing.
The loading priority follows a clear hierarchy. When a page is requested, Joomla first looks for a matching file in the active template’s html directory. If it does not find one, it then checks the child template’s html folder (if a child template is in use). Finally, if no override exists in either template, Joomla loads the file from the core extension. This order ensures that our customizations are always applied while preserving the ability to revert to the default by simply removing the override file.
Overrides exist to protect our custom code from being overwritten during Joomla updates. Core files are the responsibility of the Joomla team, and modifying them directly would mean losing all future patches and security fixes. By keeping our changes in the template layer, we maintain a clean separation between the platform and our site’s unique look and feel. This separation also makes it easier to migrate or upgrade the core without having to re‑implement custom markup.
Consider a practical scenario: we want the front‑page articles to display a custom thumbnail size and a different title style. Instead of editing com_content/views/article/tmpl/default.php directly, we create an override at templates/yourtemplate/html/com_content/article/default.php. Inside this file we adjust the HTML and CSS as needed, and Joomla will automatically use it for every article view. The result is a consistent, update‑safe customization that continues to work even when we upgrade Joomla or replace the component.
Choosing a template is often the first step toward building a brand‑specific site. After selecting one of the best Joomla templates, the natural next step is to make it truly ours. Template overrides give us the flexibility to adapt the chosen design to our content strategy and visual identity without compromising the maintainability of the site. For a deeper dive into the official guidelines, see the official Joomla override documentation.
Joomla 4 and 5 introduce a more structured html directory that mirrors the modular architecture of the CMS. For components, the path follows templates/yourtemplate/html/com_component_name/view_name. For modules, it is templates/yourtemplate/html/mod_module_name. This consistent layout makes it straightforward to locate the files you need to override, regardless of whether you’re working with a core component or a third‑party extension.
The resolution order remains the same as in earlier releases, but the presence of a child template adds an extra layer. The hierarchy is: 1) Child template html → 2) Active template html → 3) Core extension files. This means that if you have a child template, it will take precedence over the parent template’s overrides, giving you a fine‑grained control over specific sections of the site.
Several key changes differentiate Joomla 4/5 overrides from Joomla 3. The CMS now uses namespace‑based classes, so files reference Joomla\CMS instead of the old Joomla prefix. The HTMLHelper class replaces JHtml, offering a more modern API for generating common markup. MVC separation is stricter, encouraging developers to keep logic in the model and view files, and the new JLayout system provides a reusable layout engine that can be overridden independently of the component or module views.
Cassiopeia, the default template in Joomla 4 and 5, follows the same override conventions. Its html folder contains subfolders for each component and module, and the template’s CSS and JavaScript are organized in css and js directories. When you create an override for a component view, you simply copy the file into templates/cassiopeia/html/com_component_name/view_name and modify it as needed. Cassiopeia’s clean structure makes it an excellent starting point for learning how overrides work.
For hands‑on guidance, consult our Joomla 4 tutorial and explore the Joomla 4 templates collection. These resources walk you through the process of locating override files, editing them, and testing the changes in a live environment.
Component overrides target the views of a Joomla component. The most common example is com_content, the article component. To change how an article appears on the front page, you would copy com_content/views/article/tmpl/default.php to templates/yourtemplate/html/com_content/article/default.php. Inside this file you can adjust the HTML structure, add new fields, or modify the styling. The same pattern applies to other components such as com_contact (contact forms) and com_tags (tag listings). Each component’s view files are organized under its own folder, making it easy to locate the exact file you need to replace.
When overriding com_contact, you might want to add a custom map or change the layout of the contact details. By copying com_contact/views/contact/tmpl/default.php to the template’s html directory, you can insert a Google Maps iframe or reorder the fields without touching the core component. This approach keeps your customizations safe from future updates and allows you to maintain a clean separation between the component’s logic and your presentation layer.
Module overrides focus on the output of Joomla modules. The mod_login module, for instance, can be customized by copying its default layout file modules/mod_login/tmpl/default.php to templates/yourtemplate/html/mod_login/default.php. You can then change the form fields, add custom CSS classes, or restructure the markup to fit your design system. Other modules such as mod_articles_category and mod_menu follow the same pattern, allowing you to tailor navigation menus or category listings directly through the template.
Overriding mod_menu is a common way to implement a custom navigation structure. By editing templates/yourtemplate/html/mod_menu/default.php, you can add dropdowns, icons, or ARIA attributes to improve accessibility. Because the module’s core files remain untouched, any updates to the menu module will not overwrite your changes, preserving the integrity of your navigation design.
JLayout provides a reusable layout engine that can be overridden independently of components and modules. Layout files reside in the layouts folder and are called via JLayoutHelper::render(). To override a layout, you create a copy in templates/yourtemplate/layouts/ with the same name and path. For example, the article teaser layout com_content/article/teaser.php can be overridden by placing a file at templates/yourtemplate/layouts/com_content/article/teaser.php. This allows you to change the teaser presentation across the entire site without modifying each component view.
Layout overrides are especially powerful when you need to apply a consistent design pattern across multiple components. By overriding com_content/article/default.php and com_content/article/teaser.php in the template’s layouts directory, you can ensure that both full articles and teasers share the same styling and markup structure. This approach reduces duplication and keeps your design system cohesive.
Joomla 4 introduced the ability to override plugin output. Plugin overrides follow a similar pattern to component and module overrides, but the path is templates/yourtemplate/html/plg_plugin_group/plugin_name. For instance, a custom plg_system_myplugin could have its layout file modules/plg_system_myplugin/tmpl/default.php copied to templates/yourtemplate/html/plg_system_myplugin/default.php. This enables you to modify the plugin’s rendered HTML without touching its core code.
Because plugin overrides are a newer feature, documentation is still evolving. However, the same principles apply: place the override file in the template’s html folder, adjust the markup, and Joomla will prioritize it when rendering the plugin’s output. This gives developers a clean way to customize system plugins, content plugins, or any other plugin type that generates front‑end markup.
| Type | Path Pattern | Example Use Case | Available Since |
|---|---|---|---|
| Component | templates/yourtemplate/html/com_component_name/view_name/default.php | Change article layout (com_content) | Joomla 3 |
| Module | templates/yourtemplate/html/mod_module_name/default.php | Customize login form (mod_login) | Joomla 3 |
| Layout (JLayout) | templates/yourtemplate/layouts/com_component_name/view_name/layout.php | Standardize teaser design | Joomla 4 |
| Plugin | templates/yourtemplate/html/plg_plugin_group/plugin_name/default.php | Alter system plugin output | Joomla 4+ |
For a deeper understanding of how overrides work across the Joomla ecosystem, refer to the Joomla output overrides guide.
Our first method leverages the built‑in Template Manager, which provides a visual interface for creating overrides. Here’s a six‑step walkthrough using Cassiopeia as the example template. 1) Log in to the Joomla admin panel via Joomla admin panel. 2) Navigate to Extensions → Templates → Templates and select Cassiopeia. 3) Click the Overrides button to open the override manager. 4) Choose the component you wish to override, such as com_content. 5) Select the view (e.g., article) and the layout (e.g., default). 6) Click Create Override and the system will generate the necessary file structure for you.
After the override is created, you can edit the file directly in the admin editor or download it via FTP for more advanced editing. The manager also shows you the original core file path, making it easy to compare your changes against the default output. Once you save the file, the override takes effect immediately on the front end, allowing you to preview the results in real time.
For those who prefer a hands‑on approach or need to work offline, manual creation via FTP is straightforward. 1) Connect to your site’s server using an FTP client. 2) Navigate to templates/yourtemplate/html/. 3) Create the necessary folder structure that mirrors the component or module you’re targeting, for example com_content/article/. 4) Copy the original layout file from the component’s tmpl/ directory into your new folder. 5) Rename the file if needed (e.g., default.php) and open it in a code editor. 6) Modify the markup, add CSS classes, or integrate helper functions as required. 7) Save the file and upload it back to the server.
After uploading, clear Joomla’s cache through System → Clear Cache to ensure the new override is recognized. You can then visit the affected page on the front end to verify that your changes are applied. Manual creation gives you full control over the file hierarchy and allows you to keep a local copy of your overrides for version control.
<?php
/**
* @package Joomla.Site
* @subpackage com_content
*
* @copyright Copyright (C) 2024 Joomla! Project
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
use Joomla\CMS\Helper\HTMLHelper;
use Joomla\CMS\Router\Route;
use Joomla\CMS\Uri\Uri;
// Ensure no direct access
defined('_JEXEC') or die;
// Load article data
$item = $this->item;
$category = $this->category;
$author = $item->author;
$created = $item->created;
$tags = $item->tags;
$readmore = $this->params->get('show_readmore', true);
$readmoreText = $this->params->get('readmore_text', JText::_('TPL_READ_MORE'));
?>
<article id="item-<?php echo $item->id; ?>" class="article-item">
<header class="article-header">
<h2 class="article-title">
<a href="<?php echo Route::_(ContentHelperRoute::getArticleRoute($item->id, $item->catid)); ?>">
<?php echo $this->escape($item->title); ?>
</a>
</h2>
</header>
<div class="article-meta">
<span class="article-author">
<span class="article-date">
</div>
<div class="article-content">
<?php echo $item->introtext; ?>
</div>
<?php if ($readmore): ?>
<div class="article-readmore">
<a class="btn btn-primary" href="<?php echo Route::_(ContentHelperRoute::getArticleRoute($item->id, $item->catid)); ?>">
<?php echo $readmoreText; ?>
</a>
</div>
<?php endif; ?>
<?php if ($tags): ?>
<div class="article-tags">
<?php echo $tags->toString(); ?>
</div>
<?php endif; ?>
</article>
This code block demonstrates a modern article view override for Joomla 4/5. It begins with a standard PHP opening tag, a comment block that defines the package and licensing, and a security check to prevent direct script access. The use statements import the necessary Joomla classes, such as HTMLHelper for date formatting and Route for generating URLs. The article data is retrieved from $this->item, and the markup is structured with semantic <article>, <header>, and <div> elements. Conditional statements control the display of the “read more” button and tags, ensuring that the output adapts to the component’s parameters.
<?php
/**
* @package Joomla.Site
* @subpackage mod_articles_category
*
* @copyright Copyright (C) 2024 Joomla! Project
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
use Joomla\CMS\Router\Route;
use Joomla\CMS\HTML\HTMLHelper;
// Ensure no direct access
defined('_JEXEC') or die;
// Retrieve module parameters
$moduleId = $module->id;
$categoryId = $params->get('category_id');
$limit = $params->get('display_num', 5);
$showIntro = $params->get('show_intro', true);
$showReadmore = $params->get('show_readmore', true);
$readmoreText = $params->get('readmore_text', JText::_('TPL_READ_MORE'));
?>
<div id="mod-articles-category-" class="mod-articles-category">
<?php foreach ($list as $item): ?>
<article class="mod-article-item">
<h4 class="mod-article-title">
<a href="<?php echo Route::_(ContentHelperRoute::getArticleRoute($item->id, $item->catid)); ?>">
<?php echo $this->escape($item->title); ?>
</a>
</h4>
<?php if ($showIntro): ?>
<div class="mod-article-intro">
<?php echo $item->introtext; ?>
</div>
<?php endif; ?>
<?php if ($showReadmore): ?>
<div class="mod-article-readmore">
<a class="btn btn-secondary" href="<?php echo Route::_(ContentHelperRoute::getArticleRoute($item->id, $item->catid)); ?>">
<?php echo $readmoreText; ?>
</a>
</div>
<?php endif; ?>
</article>
<?php endforeach; ?>
</div>
The module override example focuses on the mod_articles_category module. It starts with a similar security check and imports Joomla classes for routing and HTML helpers. The module parameters are fetched from the $params object, allowing administrators to control the number of articles displayed, whether to show intro text, and the label for the read‑more button. The loop iterates over the $list of articles, outputting each within an <article> element. Conditional rendering ensures that optional parts, such as the intro text and read‑more link, appear only when enabled. This structure provides a clean, maintainable way to customize the module’s appearance while keeping the core module untouched.
When we first set up a Joomla site, we often copy the default layout files from the core component into our template’s html folder. From there, we can create named alternative layouts such as default_custom.php or article_featured.php. Joomla looks for these files in a specific order: it first checks the template’s html directory, then the component’s own layout folder, and finally the core. If a named layout exists, Joomla automatically loads it instead of the generic default.php. This gives us a powerful way to tailor the look of particular pages without touching the core code.
To tell Joomla which alternative layout to use, we can adjust the menu item settings or module configuration. In the menu manager, the “Layout” field allows us to select a custom layout name from a dropdown. For modules, the “Layout” option in the module’s parameters does the same. When a layout is chosen, Joomla passes the name to the component’s view, which then includes the corresponding file from the template. This makes it easy to switch between a standard article view and a featured article view simply by changing a setting in the backend.
Joomla also supports JLayout files, which are reusable snippets that can be rendered anywhere in a template. By creating a layouts folder inside templates/your_template/html/, we can place files like article/intro.php. Within a view, we call JLayoutHelper::render('article.intro', $displayData), where $displayData is an associative array of values needed by the layout. This approach keeps our templates clean and encourages reuse across multiple components.
Child templates inherit all overrides from their parent template, but they can also replace specific files. By creating a child template and copying the html folder into it, we keep the parent’s overrides untouched while adding our own modifications. If we need to change only the article view, we edit article/default.php in the child; any other files will fall back to the parent. This cascading mechanism is central to Joomla template development and lets us maintain clean separation between core and custom code.
Those who have just finished installing a Joomla template will find alternative layouts especially useful. They allow us to experiment with different page structures without risking the integrity of the default layout, and they provide a clear path for future updates.
One frequent problem is stale overrides after Joomla updates. When the core component changes its variable names or class structure, an override that still references the old code will break. To fix this, we should compare the overridden file with the latest core file, update any mismatched variables, and test the view again. Keeping the override in sync with the core ensures that our customizations remain functional.
Another mistake is an incorrect directory structure. Overrides must live in templates/your_template/html/ with the same relative path as the core component’s view. If we place a file in the wrong folder or miss the html subfolder, Joomla will ignore it and fall back to the default layout. Double‑checking the path before saving the file prevents this issue.
Hardcoding language strings instead of using Joomla’s language constants is a common source of bugs. When we embed static text directly into an override, that text will not translate for multilingual sites. By replacing hardcoded strings with Text::_('COM_CONTENT_TITLE'), we ensure that the text is pulled from the language files and can be translated by site owners.
Removing CSS classes that handle responsive design can break the mobile layout. Many Joomla templates rely on classes like col-md-6 or hidden-xs to adapt to different screen sizes. If we delete or rename these classes in an override, the page may overflow or hide essential content on phones. Restoring the original classes or adding new responsive rules is essential for a good user experience.
Hardcoding values such as image URLs or HTML tags instead of using Joomla’s API methods can lead to maintenance headaches. For example, using a static <img src="...> tag bypasses the JoomlaHelper::image() method, which handles resizing and caching. Switching to the helper method not only keeps the code clean but also ensures that images are served efficiently.
Testing overrides with only a single article or content type can hide issues that appear with different field combinations. An override that works for a standard article may break when a custom field is present. By creating multiple test articles with varying fields, we can verify that the override behaves correctly across all scenarios.
For more guidance on secure coding practices, we recommend reviewing Joomla security best practices. Secure overrides protect both the site and its visitors from potential vulnerabilities.
Enabling Joomla’s debug mode is the first step in troubleshooting overrides. In the Global Configuration under the System tab, set “Debug System” to Yes. This will display file loading information, including the exact path Joomla used to load each layout file. By seeing whether the override was loaded or the default was used, we can pinpoint the problem.
The Template Manager also provides visual indicators of override status. In Joomla 4.2 and later, a green checkmark means the override is up‑to‑date, while a warning icon signals that the override may be outdated or incompatible with the current core version. Clicking the icon reveals details about the mismatch, allowing us to address it quickly.
Using a diff tool to compare our overridden file with the one in the Joomla CMS GitHub repository is invaluable. By visiting Joomla CMS GitHub repository, we can view the latest version of the component’s view. Running a diff highlights any added, removed, or altered lines, making it easier to update our override.
Browser DevTools are useful for inspecting the rendered HTML and CSS. By opening the console and examining the DOM, we can see whether our override’s markup is present and whether the expected classes are applied. Additionally, the Network tab can reveal missing assets or broken links that may affect layout.
If we suspect the issue lies in the override rather than the core, switching to the default Cassiopeia template temporarily can help isolate the problem. By activating Cassiopeia, we can see whether the same page renders correctly without our customizations. If it does, the override is the source of the error; if not, the problem may be elsewhere.
We recommend commenting every override file with a date, purpose, and the Joomla version it was created for. This simple habit makes it easier for future developers to understand why a particular change was made and whether it needs updating. A well‑documented file reduces the risk of accidental overwrites during site maintenance.
Using Git for version control of template files is essential. By committing each change, we can track what was altered and when, and we can revert to a previous state if an override breaks. Setting up a repository for the template folder also allows collaboration with other developers.
Child templates in Joomla 4+ provide an excellent way to isolate overrides. By creating a child template and placing only the necessary overrides within it, we keep the parent template clean and maintainable. This approach is covered in detail at customizing a Joomla template.
After every Joomla or extension update, we should run an override audit. The Template Manager highlights overrides that need attention, and we can compare them against the updated core files. Addressing these issues promptly prevents broken layouts after updates.
Keeping overrides minimal helps reduce maintenance overhead. We should only change what is necessary—such as adding a new class or adjusting a markup structure—and avoid rewriting entire views unless absolutely required. Minimal changes are easier to test and less likely to introduce bugs.
For performance considerations, we recommend reviewing Joomla performance optimization. Overly complex overrides can increase page load times, so we should aim for lightweight markup and avoid unnecessary scripts.
Those using free Joomla templates should be especially careful about override compatibility. Free templates may not receive the same level of support as premium ones, so testing overrides thoroughly before deploying to production is critical.
Will Joomla template overrides survive a CMS update? Yes, if the override aligns with the updated core structure. If core files change, you may need to adjust the override accordingly.
Can we override third‑party extension output? Absolutely. By placing the appropriate layout files in your template’s html folder, you can customize how extensions render their content.
What is the difference between a template override and a child template? An override changes a specific view within a template, while a child template inherits all parent overrides and can add or replace files without affecting the parent.
How do we revert an override back to the default? Simply delete the overridden file from your template’s html folder. Joomla will then load the default layout from the core.
Do overrides affect site performance? They can, especially if the override adds heavy markup or scripts. Keeping overrides lightweight and testing performance is advisable.
For a deeper understanding of how Joomla works, we encourage you to explore the Joomla CMS documentation and community resources.