-1

I have create a custom theme and it has been register but it does not read layout & Templates.

File location: app/design/frontend/Amit/Customtheme/composer.json

{
    "name": "magento/theme-frontend-Customtheme",
    "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.2",
    "license": [
        "OSL-3.0",
        "AFL-3.0"
    ],
    "autoload": {
        "files": [
            "registration.php"
        ]
    }
}

registration.php

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

And: theme.xml

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Amit Customtheme</title>
<parent>Magento/blank</parent>
</theme>

And then try to add css/js files from app/design/frontend/Amit/Customtheme/Magento_Theme/layout/default_head_blocks.xml

<?xml version="1.0"?>
<!--
/**
 * Copyright © 2015 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
    <head>
        <remove src="css/styles-m.css" />
        <css src="css/style.css" />
        <css src="css/bootstrap.min.css" />
        <css src="css/responsive.css" />
        <css src="css/my-account.css" />
        <css src="css/home-slider.css" />
        <css src="css/easy-responsive-tabs.css" />
        <css src="css/login.css" />
        <css src="css/login-signup.css" />
        <css src="css/mega-menu.css" />
        <css src="css/cart-dropdown.css" />
        <css src="css/font-awesome.min.css" />
        <css src="css/hover.css" />
        <css src="css/animate.css" />
        <css src="css/jquery-ui.css" />
        <css src="css/settings.css" />
        <css src="css/strocke-gap-icons-style.css" />
        <css src="css/thank_you.css" />

        <script src="js/jquery.min.js"/>
        <script src="js/bootstrap.min.js"/>
        <script src="js/easy-responsive-tabs.js"/>
        <script src="js/jquery-ui.js"/>


    </head>
</page>

but this layout files does not read because of when i have check page view source then not see css/js files which are default_head_blocks.xml. Only see blank theme's css /js file

<link  rel="stylesheet" type="text/css"  media="all" href="http://example.com/pub/static/frontend/Amit/Customtheme/en_US/mage/calendar.css" />
<link  rel="stylesheet" type="text/css"  media="all" href="http://example.com/pub/static/frontend/Amit/Customtheme/en_US/css/styles-m.css" />
<link  rel="stylesheet" type="text/css"  media="screen and (min-width: 768px)" href="http://example.com/pub/static/frontend/Amit/Customtheme/en_US/css/styles-l.css" />
<link  rel="stylesheet" type="text/css"  media="print" href="http://example.com/pub/static/frontend/Amit/Customtheme/en_US/css/print.css" />
<link  rel="icon" type="image/x-icon" href="http://example.com/pub/static/frontend/Amit/Customtheme/en_US/Magento_Theme/favicon.ico" />
<link  rel="shortcut icon" type="image/x-icon" href="http://example.com/pub/static/frontend/Amit/Customtheme/en_US/Magento_Theme/favicon.ico" />
<script  type="text/javascript"  src="http://example.com/pub/static/frontend/Amit/Customtheme/en_US/requirejs/require.js"></script>
<script  type="text/javascript"  src="http://example.com/pub/static/frontend/Amit/Customtheme/en_US/mage/requirejs/mixins.js"></script>
<script  type="text/javascript"  src="http://example.com/pub/static/_requirejs/frontend/Amit/Customtheme/en_US/requirejs-config.js"></script>
            </head>

Why it does not read layout/ template files from custom theme.What i am going wrong at Theme configuration?

  • Did you run bin/magento setup:upgrade, enabled the theme from admin and deployed the content? – g5wx Apr 4 '16 at 7:31
  • yes , i have already done both command – Amit Bera Apr 4 '16 at 7:37
  • Is the template visible in your admin? – g5wx Apr 4 '16 at 7:41
  • I have already set a that Amit/Customtheme theme at admin.You see ttp://example.com/pub/static/frontend/Amit/Customtheme/en_US .. called that means theme is registered – Amit Bera Apr 4 '16 at 7:46
  • change "name": "magento/theme-frontend-Customtheme", to "name": "magento/theme-frontend-blank", this issue i only found – Qaisar Satti Apr 4 '16 at 7:46
2

Check current store scope? Do you create new store for custom theme
Flush cache and re-deploy static files. I already test in magento 2 version 2.0.4 developer mode . My custom theme loaded successful

From backend make sure magento loaded your theme in tab Content\Design\Themes If it loaded check your current store that your theme setup enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.