0

I have create my theme From default magento-luma theme so luma is a parent them of my theme.

Below is the Step that I followed to create my theme from luma.

1). copy theme-frontend-luma folder from vendor/magento and place it to app/design/frontend/package_name/theme_name.

now onwards all below changes I have done in my theme folder.

2). in register.php file I changed with my package name and theme name.

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

3). theme.xml file

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Forever Theme</title>
<parent>Magento/blank</parent>
<media>
    <preview_image>media/preview.jpg</preview_image>
</media>

Now I go to admin content->design->themes and I see that now my theme is showing there so I go to **store->configuration->general->design and assign my package and theme.

After that using CMD I run magento setup:static-content:deploy comment.

Now I go to frontend and what I see is yeah I done this. I have set up my theme for magento2 store.

but when I enable template path hint and see in frontend some of the content (modules) are coming from vendor folder.so I have done some changes in vendor folder. So If I upgrade my magento version so will my changes remove?

Now what I want is below.

Like magento 1.x if we create theme from base folder then all modules are coming from our theme folder not from base I want same for magento 2.x And I don't want to come any module from vendor folder. so what I need to do?

2 Answers 2

1

To copy luma,blank theme or module templates, layout and web files to own custom theme

1) To Copy template file:

vendor/magento/module-catalog/view/frontend/templates/product/list.phtml

Follow this path

app/design/frontend/Vendor/theme/Magento_Catalog/templates/product/list.phtml

2) To Copy layout file:

vendor/magento/module-catalog/view/frontend/layout/catalog_product_view.xml

Follow this path

app/design/frontend/Vendor/theme/Magento_Catalog/layout/catalog_product_view.xml

0

You have to do overrider those templates into your custom theme.

By default first go to your theme folder and get templates file if required templates are not found then they go to core magento/module-Vendor folder and fetch required templates from module.

So you have to either override into your theme folder or they fetch from required module.

You can override your module folder tempates to your theme like this,

Example, if YOu want to override magento2/vendor/magento/module-catalog/view/frontend/templates/product/list.phtml then you have to create your custom theme.

For Overrider list.phtml file into your theme, go to path , app/design/frontend/templates/Packagename/theme_name/Magento_Catalog/templates/product/list.phtml

Now your list file is overriden by your theme.

Same as above any module file you can override.

Here module-catalog becomes inside our theme is Magento_Catalog. Like override file of module-configurable-product template you have to create folder inside your theme like Magento_ConfigurableProduct and create templates folder and remaining path are same for templates.

Moreinfo you can check link, Override Templates

1
  • How can I override all the template and layout from vendor to my theme?
    – Dhaval
    Jul 4, 2016 at 8:02

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.