Please follow the steps to create a custom theme in Magento 2
Step 1: Create a directory for Theme
Create a directory in app/desing/frontend/ with vendor name and theme like:
app/design/frontend/vendorName/themeName
Step 2: Declare theme.xml under the theme directory
Create a theme.xml file under “app/design/frontend/vendorName/themeName” this file will have theme name, parent theme name and preview of the theme.
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd"> <title>Vendor ThemeName</title> <!-- your theme name --> <parent>Magento/blank</parent> <!-- the parent theme, in case your theme inherits from an existing theme like luma/blank--> <media> <preview_image>media/preview.jpg</preview_image> <!-- the path to your theme preview image --> </media> </theme>
Step 3: Create a composer file Composer file under the theme directory
Magento 2 themes are distributed as Composer packages so it will be registered as a Package on the server.
Add a file composer.json which is optional
Ex: app/design/frontend/vendorName/themeName/composer.json
{ "name": "vendorName/themeName", "description": "N/A", "require": { "php": "~5.5.0|~5.6.0|~7.0.0", "magento/theme-frontend-blank": "100.0.*", "magento/framework": "100.0.*" }, "type": "magento2-theme", "version": "100.0.1", "license": [ "OSL-3.0", "AFL-3.0" ], "autoload": { "files": [ "registration.php" ] } }
Step 4: Adding registration.php under theme directory
Ex: app/design/frontend/vendorName/themeName/ registration.php
<?php /** * Copyright © 2017 Magento. All rights reserved. * See COPYING.txt for license details. */ \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::THEME, 'frontend/vendorName/themeName', __DIR__ );
Step 5: Check all above files properly before running the upgrade and deploy command because once you run the command. Magento will generate a table for the theme.
Step 6: Run setup upgrade and deploy commands.
Setup Upgrade Command: php bin/magento setup:upgrade
Setup Deploy Command: php bin/magento setup:static-content:deploy
(If developer mode is enabled then you need to run deploy with -f flag like php bin/magento setup:static-content:deploy -f)
Step 7: Check theme in Backend
Go to ‘Content > Themes’ and you can see the theme you created.
Step 8: Assign a custom theme to store
Goto ‘Content > Configuration’.
Click on the edit button in action column and assign theme drop down.
Please contact us at manish@bay20.com or call us at +91-8800519180 for any support related to Magento 2. You can also visit the Magento2 development page to check the services we offer.