0

I'm creating theme to be added to my store but it doesn't work here is default.xml in the following directory: magento_directory\app\design\frontend\vendor_name\theme_name\layout

<?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">
<body>
    <referenceContainer name="header-wrapper" remove="true">
        <block class="Magento\Framework\View\Element\Template" name="customtext" template="MyTheme::customtext.phtml" />
    </referenceContainer>
</body>
</page>

here is my customtext.phtml file in the following directory magento_directory\app\design\frontend\vendor_name\theme_name\templates

<div class="block" style="float: right;margin-bottom: 0.5%;margin-top: 0.5%;">
   <?php echo __('This is Custom Text'); ?>
</div>

and theme.xml file in the following directory magento_directory\app\design\frontend\vendor_name\theme_name

<?xml version="1.0"?>
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>My theme</title> <!-- your theme's name -->
    <parent>Magento/blank</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->

</theme>
1

you have incorrect folder structure, if you want to change template / layout of "module-search" module Then you should name that folder like that Magento_Search.

so like that, if you want to customize any template / layout of "module-catalog" your folder name will be "Magento_Catalog". in other words change "module" to "Magento" and then module name.

so here you will see module is replaced with Magento and module name will be named with first letter capital i.e search will become Search.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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