1

) I need a tip. I've installed a theme via composer and I need to create a child theme having as parent a theme installed via composer.

path of theme installed via composer: vendor/{vendor}/{theme}/ path of child theme: app/design/frontend/{vendor}/{theme}/

in the child theme folder i've created: theme.xml

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>TitleTheme</title>
    <parent>{folder-name-vendor}/{folder-name-theme}</parent>
    <media>
        <preview_image>media/preview.jpg</preview_image>
    </media>
</theme>

Composer.json

{
    "name": "{my-vendor-folder}/{my-child-theme}",
    "description": "N/A",
    "require": {
        "php": "~5.5.0|~5.6.0|~7.0.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
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'frontend/{my-vendor-folder}/{my-child-theme}',
    __DIR__
);

When I change the theme from the magento backend panel under Content > Design > Configuration and then run: php bin/magento setup:upgrade php bin/magento setup:static-content:deploy

It does not load me the parent theme I have chosen, but the default magento theme.I don't know what I'm wrong. Can someone help me? Thank you ;)

1
  • Have you found the solution of this problem? Nov 19, 2020 at 17:00

1 Answer 1

0

I had the same problem. I was using _extend.less in the child theme to add my own styles. But as it turned out the parent theme had an _extend.less extending the blank theme. This approach using a _extend-child.less helped me solve it;

https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/css-guide/css_quick_guide_approach.html

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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