Magento 2 How To Create Child-Theme



How to Create Child-Theme

Step 1: Create child-them folder

Got to :
app\design\frontend\

Here you will see the folder structure
app\design\frontend\Vender_Name\Theme_Name

Child-theme folder need to be created like

app\design\frontend\Vender_Name\Theme_Name-child

Example:

Parent theme:  
app\design\frontend\Smartwave\porto

Child-Theme folder:
app\design\frontend\Smartwave\porto-child

Step 2 :  Copy file/folder from parent
Copty following files and folder from parent theme .

registeration.php
theme.xml
media folder
web folder


Step 3:  modify theme.xml

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>Smartwave Porto Child</title>
<parent>Magento/blank</parent>
    <media>
        <preview_image>media/preview.png</preview_image>
    </media>
</theme>

Change title :
from Smartwave Porto to Smartwave Porto Child its optional.

Set Parent Path:

<parent>Smartwave\porto</parent>

Step 4: Modify registeration.php

\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'frontend/Smartwave/porto',
    __DIR__
);

update child theme path 
    'frontend/Smartwave/porto-child',

Step 5:
Go to the admin/backend and activate child theme.




No comments:

Post a Comment