How to create an Custom Admin theme in Magento 2
- August 8, 2021
Magento 2 admin theme allows the admin to have a customized backend panel with custom logo, font, responsive design which makes it easier for the admin to administer!
1.) Create theme directory
In the app/design/adminhtml directory create a new Vendor/theme directory.
app/design/adminhtml/M2e/dev/
Inside theme directory create theme.xml file
<?xml version="1.0" ?> <theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd"> <title>M2e admin </title> <!-- your theme's name --> <parent>Magento/backend</parent> <!-- the parent theme--> </theme>
2.) Create registration.php inside theme directory
<?php use \Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::THEME, 'adminhtml/M2e/dev', __DIR__);
Now we have to Apply admin theme
3.) Create custom module to apply your admin theme
i)M2e/Dev/registration.php
<?php use Magento\Framework\Component\ComponentRegistrar; ComponentRegistrar::register(ComponentRegistrar::MODULE, 'M2e_Dev', __DIR__);
ii)M2e/Dev/etc/module.xml
<?xml version="1.0" ?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd"> <module name="M2e_Dev"/> <sequence> <module name="Magento_Theme"/> </sequence> </config>
iii) M2e/Dev/etc/di.xml
<?xml version="1.0" ?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Theme\Model\View\Design"> <arguments> <argument name="themes" xsi:type="array"> <item name="adminhtml" xsi:type="string">M2e/dev</item> </argument> </arguments> </type> </config>
final step install the module
php bin/magento setup:upgrade
php bin/magento setup:di:compile
One can create a custom admin theme in Magento 2 and include features like search tool, neat and clean panel arrangement, translation ready, custom colors, and much more!
Any doubts about the custom admin theme?
If so, feel free to mention them in the Comments section below.
I’d be happy to help.
we are expert in creating custom Theme in Magento 2 so feel free to contact us
About us and this blog
We are a digital magento 2 development agency with a focus on helping our customers achieve great results across several key areas.
More From Our Blogs
See all postsRecent Posts
- How to setup virtual host on XAMPP for Magento 2 local development March 13, 2023
- What’s New In Magento 2.4.6 ? Features, Enhancements . March 9, 2023
- How to Create Controller in Magento 2 March 5, 2023