Create Custom theme in Magento 2

What is theme :- The theme is a component of Magento 2 which gives a consistent look and feel to your whole store. It provides an improved look to areas like Magento 2 Admin and Storefront by utilizing a combination of custom templates, designs, styles or images development.

 How to Create Custom Theme :- First see the theme folder structure




step 1 :- Go to your app/design/frontend and create two folder first vendor name and theme name

Finally, theme Path is app/design/frontend/Mage/Mohit/


Step 2 :- Create registration.php file. This path  app/design/frontend/Mage/Mohit/registration.php .


<?php

use \Magento\Framework\Component\ComponentRegistrar;

ComponentRegistrar::register(ComponentRegistrar::THEME, 'frontend/Mage/Mohit', __DIR__);


Step 3 :- Create theme.xml file. This path  app/design/frontend/Mage/Mohit/theme.xml .


<!--
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>Mage Mohit</title>
    <parent>Magento/luma</parent>
    <media>
        <preview_image>media/preview.jpg</preview_image>
    </media>

</theme>


step 4 :- Go to vendor\magento\theme-frontend-luma and copy the media folder and put the your custom theme root.

Like :-  app/design/frontend/Mage/Mohit/media


Step 5 :- Go to vendor\magento\theme-frontend-luma copy the etc folder and put the your custom theme root.

Like :-  app/design/frontend/Mage/Mohit/etc


Step 6 :- Create web folder . In web folder include css folder , fonts folder , js folder etc.


And finally, your folder showing 


Step 7 :- After create all folder run some command :- 

> php bin/magento setup:upgrade 
> php bin/magento setup:static-content:deploy -f
> php bin/magento cache:clean
> php bin/magento cache:flush

Step 8 :- Go to admin panel Content > Configuration >  select your store and click edit button > Applied theme drop-down open the see your theme name . 




Step 9 :-  After applied theme click save configuration button . And run php bin/magento cache:flush .


Step 10 :- How to check your theme apply or not.So go to your homepage and ctrl+u . See Screen-short 



Your theme name are showing.So your theme applied.


Hope help you 


Thanks ...  

Comments