I want to modify certain aspects of the out-of-the-box Luma theme but I would like to do it by preserving the original file(s) and also ensuring that whenever I update Magento I preserve my changes as well.
I want to do this by way of a Child Theme.
Does Magento 2 support child themes and, if so, how do I structure my directory path to make this happen?
Solved! Go to Solution.
Hi @sportame
You can create a child theme in Magento 2. You should use Luma as parent theme.
Please refer following official documentation Create a theme
As per the link you should use following( mentioned under declare your theme section of documentation)
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd"> <title>New theme</title> <!-- your theme's name --> <parent>Magento/luma</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>
Hi @sportame
You can create a child theme in Magento 2. You should use Luma as parent theme.
Please refer following official documentation Create a theme
As per the link you should use following( mentioned under declare your theme section of documentation)
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd"> <title>New theme</title> <!-- your theme's name --> <parent>Magento/luma</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>
I followed the instructions and got this error:
There has been an error processing your request
Exception printing is disabled by default for security reasons.
Error log record number: 704914686841
When I comment out the contents of the registration.php file, the error goes away
Hi @sportame
Go to var/reports folder and open report number 704914686841.
It contains the error message based on that you have to debug.
HI, Just a note do not use luma as a parent theme, magento strongly advises against this as it is often changed during upgrade, always use another theme blank theme
hi PHPCuong, video is not available
The video link is updated, you can learn How to create a child theme in magento 2