I am attempting to create a custom theme utilizing the fallback mechanism. The issue I have encountered is that my theme is only falling back to blank.
This is occurring even though I have set the parent to be luma. I have confirmed in the 'core_config_data' table that my theme is applied. As well as the 'theme' table, my theme (vendor_theme) has the correct parent id that corresponds to luma.
theme.xml:
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Vendor Theme</title>
<parent>Magento/luma</parent></theme>
registration.php:
<?php
\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
'frontend/Vendor/vendor_theme',
__DIR__
);
Is there a step that I am missing here?
Also are there any comprehensive tutorials/guides related to custom theme development?
Best Answer
Lets us create a child theme so our all custom themes in Magento 2 goes here:
Let us assume, our company name is mycompany and our theme name is basic. We need to create following directory structure for our theme:
mycompany :-
The name of the theme package
basic :- The name of the theme. We can have multiple named themes inside the mycompany folder.
etc/view.xml :-
This file is used to specify product image dimensions, thumbnails etc.
Magento_Theme :- This directory is used to override existing Magento’s theme files.
Magento_Theme/layout/default.xml :- By default Magento2 assumes that your theme’s logo file should be:
/web/media/logo.svg
If you want some other file for logo, then you must declare it indefault.xml
file.This file is also used to override default theme’s settings.
media/preview.png :- The preview of current theme.
web :- This directory contains all the theme’s static data like images, styles, javascript, fonts etc.
registration.php :- This file is required to register our theme to Magento2 system.
theme.xml :- This is a compulsory file that defines our theme name, its parent and optionally theme’s preview image.
Creating theme files
Let us now create our files one by one.
At this point, our theme is ready. Clear your cache and we will now select our new theme from admin.
Now, login to admin and move to following path:
You should see your theme listed.
Now go to:
Choose Main Website in front of Store View at top left. Now click
Uncheck Use Default checkbox and pick your theme. Click Save Config, clear your cache and your new theme is ready. Check your home page.
For more detail see here.