This method works for Magento 1 but not for Magento 2 (version 0.42.0-beta10): http://www.magentocommerce.com/wiki/4_-_themes_and_template_customization/admin/using_custom_admin_theme_templates
5 Answers
The Process is quite similar to creating a theme for frontend.
1. Create theme.xml in
app/design/adminhtml/<yourpackage>/<yourtheme>/theme.xml
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
<title>Magento 2 backend</title>
<parent>Magento/backend</parent> // set parent theme
</theme>
2. Register theme in
app/design/adminhtml/<yourpackage>/<yourtheme>/registration.php
3. Enable theme.
you can enable frontend theme in admin, but for backend you need to enable the theme through di.xml
in app/code/Magento/Theme/etc/di.xml
, you can find block of code below.
add this block of code to your module and change adminhtml to your admin package and theme name.
<type name="Magento\Theme\Model\View\Design">
<arguments>
<argument name="themes" xsi:type="array">
<item name="frontend" xsi:type="string">Magento/luma</item>
<item name="adminhtml" xsi:type="string">Magento/backend</item>
</argument>
</arguments>
</type>
Now you can overwrite something in you admin theme to see whether it works.
-
-
2step 3 improved here magento.stackexchange.com/a/120960/23344– LucScuCommented Jun 15, 2016 at 7:36
-
1after setup:static-content:deploy nothing is created to my new adminhtml theme, what I'm missing? I try several config on the composer.json but still no create nothing under static content. Any suggestion? Commented Jun 15, 2016 at 16:28
-
2My custom admin theme has no static files generated after running
setup:static-content:deploy
Commented Aug 6, 2016 at 9:51 -
The theme system has changed a bit in Magento 2 but there are similarities.
First you need to create a theme folder in app/design/frontend
. The folder structure is similar to the modules structure. You have to have a vendor name (in Magento 1 was called package) and a theme folder .
So create app/design/frontend/Vendor/theme
.
Then you have to declare your theme.
you need to create inside your theme folder a file theme.xml
with the following content:
<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/Config/etc/theme.xsd">
<title>Your theme name</title>
<parent>Magento/blank</parent><!-- or any other parent theme similar to Magento 1.9 -->
<media>
<preview_image>media/preview.jpg</preview_image>
</media>
</theme>
then create a preview image of your theme inside your theme in the media
folder(create this also) and call the preview image preview.jpg
(as declared in the XML above).
Now your theme is set.
If you want to change something from the parent theme all you need to do is copy the file you want to change (layout, template) to your theme from the specific module and do your magic.
For example if you want to change the way that the product view page looks like copy the file app/code/Magento/Catalog/view/frontend/layout/catalog_product_view.xml
to app/design/frontend/Vendor/theme/Magento_Catalog/layout/catalog_product_view.xml
and change what you need.
More details about creating a theme can be found here.
I also found a sample theme that you can use as guideline.
You can also install the official sample data and you will get a theme called luma
where you can see the folder structure.
-
Thanks for you answer! But I think I need to translate my bad, sorry.– MathieuCommented Mar 2, 2015 at 10:16
-
I want overiding backend theme (admin theme), not frontend.– MathieuCommented Mar 2, 2015 at 10:17
-
That's no problem. The steps are the same, but instead of
frontend
useadminhtml
in the folder structure. The principle is the same.– Marius ♦Commented Mar 2, 2015 at 10:21 -
Ok, thanks. But, I do not understand how to declare the new theme for admin. Is there :"app/code/Magento/Backend/etc/config.xml" ?– MathieuCommented Mar 2, 2015 at 10:34
-
<stores> <admin> <design> <package> <name>default</name> </package> <theme> <default>backend</default> </theme> </design> </admin> </stores>– MathieuCommented Mar 2, 2015 at 10:34
In case someone has problems with generating static files for newly created admin theme. In order for magento to generate files for backend theme on setup:static-content:deploy, app/design/adminhtml/<yourpackage>/<yourtheme>/web/
folder should contain files. Any dummy file would do the job.
-
I created a blank main.css in a web folder and I still get no static files created– ScottCommented Apr 24, 2018 at 23:05
-
@Scott Have you also done all the required steps that Marius suggested in his answer? And how exactly relative path to main.css looks like in your occasion? Commented Apr 25, 2018 at 13:43
To create admin Theme please follow below links, it must be work.
The official guide can be found here: https://devdocs.magento.com/guides/v2.4/frontend-dev-guide/themes/admin_theme_create.html