cancel
Showing results for 
Search instead for 
Did you mean: 

Theme not showing

SOLVED

Theme not showing

Been trying for half a day now to make my magento theme show up... without luck... It is not displayed in Content/Themes. What have I missed/need to do?

 

Created a bunch of folders and files

www/magento/pub/static/frontend/MyPackage/mytheme2 
Magento_Theme  (layout/default.xml)
media  (has a preview img)
web (has empty css & image & js folders)
composer.json
registration.php
theme.xml

 

 

Theme.xml

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

registration.php

<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
 
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'frontend/MyPackage/mytheme2',
    __DIR__
);

composer.json

{
    "name": "MyPackage/mytheme2",
    "description": "N/A",
    "require": {
        "php": "~5.5.0|~5.6.0|~7.0.0",
        "magento/theme-frontend-luma": "~100.0",
        "magento/framework": "~100.0"
    },
    "type": "magento2-theme",
    "version": "1.0.0",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "autoload": {
        "files": [ "registration.php" ]
    }
}

 

1 ACCEPTED SOLUTION

Accepted Solutions

Re: Theme not showing

-> www/magento/pub/static/frontend/MyPackage/mytheme2

You shouldn't create a theme directly in pub/static directly as it is MEANT to be for STATIC FILES only. Magento compiler is used for this. You should either create your theme in app/frontend or vendor/{vendorName}/mytheme2 directory. 

Once you have created the theme in the right folder, run the following: 

 

php magento cache:clear

 

php magento setup:upgrade

  

php magento setup:di:compile

The following will deploy your theme to pub/static directory: 

php magento setup:static-content:deploy --theme {vendorName}/myTheme2

 Let me know if that helps. 

Magento Certified Solution Specialist | Lead Magento developer
If this response was helpful to you, consider giving kudos to this post

View solution in original post

3 REPLIES 3

Re: Theme not showing

Have you done?

bin/magento setup:upgrade
bin/magento cache:flush

 

If this response was helpful to you, consider giving kudos to this post.
If this response solved your problem, click accept as solution to help others solve this issue

Re: Theme not showing

-> www/magento/pub/static/frontend/MyPackage/mytheme2

You shouldn't create a theme directly in pub/static directly as it is MEANT to be for STATIC FILES only. Magento compiler is used for this. You should either create your theme in app/frontend or vendor/{vendorName}/mytheme2 directory. 

Once you have created the theme in the right folder, run the following: 

 

php magento cache:clear

 

php magento setup:upgrade

  

php magento setup:di:compile

The following will deploy your theme to pub/static directory: 

php magento setup:static-content:deploy --theme {vendorName}/myTheme2

 Let me know if that helps. 

Magento Certified Solution Specialist | Lead Magento developer
If this response was helpful to you, consider giving kudos to this post

Re: Theme not showing

ShoaibRehman89

 

Thanks, it worked!