I want to override this file in my custom module:


How can I achieve this?

Thanks for any help!

1 Answer 1


Yes you can override it. Create a simple module like below:

Step 1: Create registration.php like below.


with below content:



Step 2: Create module.xml like below.


with below content:

<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Module/etc/module.xsd">
    <module name="Vendor_Module" setup_version="0.0.1"></module>
            <module name="Magento_Backend"/>
             <module name="Magento_Sales"/>
            <module name="Magento_Quote"/>
            <module name="Magento_Checkout"/>

Step 3: Create default.xml like below.


with below content:

<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <update handle="styles"/>
        <referenceBlock name="page.title">
            <action method="setTemplate">
                <argument name="template" xsi:type="string">Vendor_Module::title.phtml</argument>

Step 4: Create title.phtml like below.


with below content:

// @codingStandardsIgnoreFile

 * @var $block \Magento\Theme\Block\Html\Title
$titleId = ($block->getTitleId()) ? ' id="' . $block->getTitleId() . '"' : '';
$titleClass = ($block->getTitleClass()) ? ' ' . $block->getTitleClass() : '';
$title = $block->escapeHtml($block->getPageTitle());

<div class="page-title-wrapper<?= /* @escapeNotVerified */ $titleClass ?>">
    <h1 class="page-title"<?= /* @escapeNotVerified */ $titleId ?>><?= /* @escapeNotVerified */ $title ?></h1>
    <?= $block->getChildHtml() ?>

Add something to H1 tag to test if its working or not.

Flush the magento cache and test.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.