Skip to main content
added 1247 characters in body
Source Link
Vinaya Maheshwari
  • 2.2k
  • 4
  • 36
  • 76

I want to change page title in child theme for contact-us page. But when I'm trying to override file Magento_Contact/templates/form.phtml in my child theme from parent theme then on frontend the page showing blank. I also copied layout/contact_index_index.xml and all other templates too, still template file overridden not working.

How do I override Magento_Contact/templates/form.phtml?

My Parent theme contact_index_index.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <head>
        <title>Contact Us</title>
    </head>
    <body>
        <referenceContainer name="page.top">
            <block class="Namespace\Theme\Block\Template" name="google_map" template="Magento_Contact::google_map.phtml"/>
        </referenceContainer>
        <referenceContainer name="content">
            <block class="Namespace\Theme\Block\Template" name="contactPage" template="Magento_Contact::contact_page.phtml">
                <block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
                    <container name="form.additional.info" label="Form Additional Info"/>
                </block>
            </block>
        </referenceContainer>
    </body>
</page>

I want to change page title in child theme for contact-us page. But when I'm trying to override file Magento_Contact/templates/form.phtml in my child theme from parent theme then on frontend the page showing blank. I also copied layout/contact_index_index.xml and all other templates too, still template file overridden not working.

How do I override Magento_Contact/templates/form.phtml?

I want to change page title in child theme for contact-us page. But when I'm trying to override file Magento_Contact/templates/form.phtml in my child theme from parent theme then on frontend the page showing blank. I also copied layout/contact_index_index.xml and all other templates too, still template file overridden not working.

How do I override Magento_Contact/templates/form.phtml?

My Parent theme contact_index_index.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="../../../../../../../lib/internal/Magento/Framework/View/Layout/etc/page_configuration.xsd">
    <head>
        <title>Contact Us</title>
    </head>
    <body>
        <referenceContainer name="page.top">
            <block class="Namespace\Theme\Block\Template" name="google_map" template="Magento_Contact::google_map.phtml"/>
        </referenceContainer>
        <referenceContainer name="content">
            <block class="Namespace\Theme\Block\Template" name="contactPage" template="Magento_Contact::contact_page.phtml">
                <block class="Magento\Contact\Block\ContactForm" name="contactForm" template="Magento_Contact::form.phtml">
                    <container name="form.additional.info" label="Form Additional Info"/>
                </block>
            </block>
        </referenceContainer>
    </body>
</page>
Source Link
Vinaya Maheshwari
  • 2.2k
  • 4
  • 36
  • 76

Magento2 : How to override contacts form.phtml in child theme

I want to change page title in child theme for contact-us page. But when I'm trying to override file Magento_Contact/templates/form.phtml in my child theme from parent theme then on frontend the page showing blank. I also copied layout/contact_index_index.xml and all other templates too, still template file overridden not working.

How do I override Magento_Contact/templates/form.phtml?