Magento 2 – Child Theme Not Inheriting

magento2theme

I have just started to use magento and made a child theme of Blank. I have followed the documentation about making a theme at

devdocs.magento.com

And i have activated the theme but the problem is i dont know why require.js or Icons are not loading. I have tried to deploy the static content but no results, do i have to copy them from Parents theme (But shouldn't child theme inherit?)

Console error

Folder Structure

app/design/frontend/myVendor/
├── myTheme/
│   ├── etc/
│   │   ├── view.xml //Copy from vendor/magento/theme-frontend-blank
│   ├── media/
│   │   ├── preview.jpg
│   ├── web/
│   │   ├── images
│   │   │   ├── logo.svg 
│   │   ├── css
│   │   │   ├── source
│   │   ├── fonts
│   │   ├── js
│   ├── registration.php
│   ├── theme.xml
│   ├── composer.json

Also my registration.php

 <?php
  /**
  * Copyright © 2015 Magento. All rights reserved.
  * See COPYING.txt for license details.
  */

 \Magento\Framework\Component\ComponentRegistrar::register(
   \Magento\Framework\Component\ComponentRegistrar::THEME,
   'frontend/myVendor/myTheme',__DIR__);

And theme.xml

 <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
 <title>myTheme</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>

And also a question, does magento looks in vendor for theme? ( i have read that if it doesnt find it in app/design/frontend that it gets it from vendor)

Issue about this on git with answer

If understood it correctly it wouldnt make me select this theme if it didn't

Best Answer

You have to just create theme inside app/design folder.

Folder Structure

app/design/frontend/Vendor/
├── myTheme/
│   ├── etc/
│   │   ├── view.xml //Copy from vendor/magento/theme-frontend-blank
│   ├── media/
│   │   ├── preview.jpg
│   ├── web/
│   │   ├── images
│   │   │   ├── logo.svg 
│   │   ├── css
│   │   │   ├── source
│   │   ├── fonts
│   │   ├── js
│   ├── registration.php
│   ├── theme.xml
│   ├── composer.json

You have to create layout folder its position is inside module folder.

like, Magento_Catalog/layout/*.xml file

Try using above concepts its working.

Thanks.

Related Topic