Question

I am new to Magento front end development while creating my custom theme,

I have created app\design\frontend\custom\themename and inside that created my theme.xml file.

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
     <title>themename</title> <!-- your theme's name -->
     <parent>Magento/blank</parent> <!-- the parent theme, in case your theme inherits from an existing theme -->
     <media>
         <preview_image>media/preview.jpg</preview_image> <!-- the path to your theme's preview image -->
     </media>
 </theme>`

But in Stores->Configuration->Design->Design Theme not showing my theme name in dropdownenter image description here

Was it helpful?

Solution

You need to create media folder and inside that folder add your preview.jpg file.

Create registration.php file inside theme,

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
                \Magento\Framework\Component\ComponentRegistrar::THEME,
                'frontend/custom/themename',
                __DIR__
);

Run command,

php bin/magento setup:upgrade

php bin/magento setup:static-content:deploy

Check your theme inside

Content -> Design -> Configuration

Now check in your backend, enter image description here

Clear cache and var folder content.

Thanks.

OTHER TIPS

You need to create registration.php to register your theme.

Registration.php file code :

<?php
\Magento\Framework\Component\ComponentRegistrar::register(
                \Magento\Framework\Component\ComponentRegistrar::THEME,
                'frontend/Vendorname/themename',
                __DIR__
);

After that clear the cache by running cache:clean command and check it will show in design configuration setting dropdown

Also from admin click on Content->Design->Configuration here you can see your custom theme

For more details refer this link - http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/theme-create.html

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top