How to create a theme in Magento 2

You need to create the theme.xml file under app/design/frontend/Cloudways/m2-theme/theme.xml and use the code below:



<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd"> <title>m2-theme</title> <parent>Magento/Luma</parent> <media> <preview_image>media/m2-theme-image.jpg</preview_image> </media> </theme>

In <title> tag insert the name of your theme, and in the <parent> tag you can specify parent theme for fallback purposes. I am using the Luma theme.

In the <preview_image> tag I declare a theme image. This is a thumbnail image which shows in the Magento 2 admin on our theme page so we can see a preview of what our theme looks like. Thumbnail image is located in app/design/frontend/Cloudways/m2-theme/media/m2-theme-image.jpg. Make sure you have this thumbnail in the correct location. If you don’t have this file in the correct location, you will get an error when you visit your theme page in Magento 2 admin.




admin

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top