2

I am trying to change the Magento 2.1.0 theme folder name to my companyname. But I cannot find any help online.

Please help.

1
  • Which theme folder you are trying to change ? Commented Dec 28, 2016 at 8:30

5 Answers 5

5

Here is my solution to change theme name:
1) Change folder name:

app/design/frontend/{your-vendor}/{folder-theme}/

2) Change path name in registration.php file:

app/design/frontend/{your-vendor}/{folder-theme}/registration.php

<?php    
\Magento\Framework\Component\ComponentRegistrar::register(
    \Magento\Framework\Component\ComponentRegistrar::THEME,
    'frontend/{your-vendor}/{folder-theme}',
    __DIR__
);

3) Change path name in theme.xml file:

app/design/frontend/{your-vendor}/{folder-theme}/theme.xml

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
    <title>{theme-name}</title>
    <parent>Magento/luma</parent>
</theme>

NOTE: After changing you have to run this conmand:

php bin/magento setup:static-content:deploy

5
  • i tried same as you mention. But I got these errors. There has been an error processing your request Item (Magento\Theme\Model\Theme\Data) with the same ID "0" already exists.
    – Zaid Butt
    Commented Dec 28, 2016 at 9:20
  • give me your file content: app/design/frontend/{your-vendor}/{folder-theme}/registration.php
    – MrTo-Kane
    Commented Dec 28, 2016 at 10:16
  • \Magento\Framework\Component\ComponentRegistrar::register( \Magento\Framework\Component\ComponentRegistrar::THEME, 'frontend/default/zaid', DIR );
    – Zaid Butt
    Commented Dec 28, 2016 at 10:23
  • Please change 'default' to another name
    – MrTo-Kane
    Commented Dec 28, 2016 at 10:39
  • 1
    Thanks alot. Your method worked. Real issue is regarding to my DB->database->theme table was not auto incrementing my values, and also I changed composer.json file.
    – Zaid Butt
    Commented Dec 28, 2016 at 11:09
1

First,you need to check the magento blog http://devdocs.magento.com/guides/v2.1/frontend-dev-guide/themes/theme-create.html

There are few step,you need to do for this changes:

Change folder name from

app/design/frontend/<ThemeVendorname>/<YourCurrentTHeme>

to

app/design/frontend/[YorComapanyname]/[YourThemeName]

As you have changing folder name so, you need to change some files

registration.php -> app/design/frontend/[YorComapanyname]/[YourThemeName]

Change:

frontend/<ThemeVendorname>/<YourCurrentTHeme> 

to

 frontend/[YorComapanyname]/[YourThemeName]

Also, at composer.json file ,you can change theme name "name": "magento/[Current_theme_value]" to You wish

  1. Delete old theme registration from db at theme table.Please take db back before do that
  2. Then You need flus magento cache
  3. apply theme from admin
  4. Then you should deploy static content
2
  • what to do with theme registration from DB. Should I delete all the data from theme table !
    – Zaid Butt
    Commented Dec 28, 2016 at 9:12
  • Your answer is also a correct one. Thanks for that.
    – Zaid Butt
    Commented Dec 28, 2016 at 11:10
0

For the renaming theme, you have to create your own then and copy paste default theme content in your theme.

1. Create Theme Directory

app/design/frontend/<vendor>/<themename>

2. Declare your theme

app/design/frontend/vendor/themename/composer.json

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
  <title>m2-theme</title>
  <parent>Magento/Luma</parent><!--here you can add your parent theme-->
  <media>
     <preview_image>media/m2-theme-image.jpg</preview_image> <!-- add image path {optional} -->
  </media>
</theme>

3. Make Your Theme a Composer package

app/design/frontend/vendor/themename/composer.json

{
 "name": "<vendor>/<themename>", //Change with your vendor and theme
 "description": "N/A",
  "require": {
    "php": "~5.5.0|~5.6.0|~7.0.0",
   "<vendor>/<themename>": "100.0.*",
    "magento/framework": "100.0.*"
  },
  "type": "magento2-theme",
  "version": "100.0.1",
  "license": [
    "OSL-3.0",
    "AFL-3.0"
  ],
  "autoload": {
    "files": [
        "registration.php"
    ]
  }
}

4.Add registration.php to register your theme

\Magento\Framework\Component\ComponentRegistrar::register(
\Magento\Framework\Component\ComponentRegistrar::THEME,
 'frontend/<vendor>/<themename>',
  __DIR__
);

Now go to Stores > Configuration > Design in your admin section. and select your theme

NOTE: don't forget to recompile and deploy

0

Just go to your theme

app/design/frontend/Magento/theme

and here you see theme.xml file.

Just change Title Name as you want as a theme name and it's displayed in backend admin theme name.

-3

Follow above step

  1. Give Write recursive permission to Design folder
1
  • Is that really Answer to my question! @mrunmay-deswandikar
    – Zaid Butt
    Commented Dec 28, 2016 at 9:22

Your Answer

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

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