How to Apply an Admin Theme in Magento 2
Previously, we saw the steps to create an admin theme in Magento 2.
Custom admin themes in Magento 2 can be created for:
- customized backend
- brand logo
- handy tools
- responsiveness
- favourable colours
- easy administration
However, you also need to apply an admin theme in Magento 2 for leveraging these benefits.
The below tutorial shows the stepwise method for the same:
Steps to apply an admin theme in Magento 2:
Requirements:
- Set the Magento into developer mode. Refer Magento 2 modesfor the steps.
- Create a custom admin theme as shown earlier.
- Create module.xml in app/code/[Vendor]/[Module]/etc and add the following code:
12345<module name="[Vendor]_[Module]" setup_version="0.0.1"><sequence><module name="Magento_Theme"/></sequence></module>
Applying a custom admin theme in Magento 2:
- Create di.xml in app/code/[Vendor]/[Module]/etc/adminhtml and add the following code:
123456789<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">[Namespace]/[themename]</item></argument></arguments></type></config> - Run the bin/magento setup:upgrade command to update the components.
- Open the Admin in the browser and view the new theme applied.
That’s it. Also before applying admin theme I recommend you to change default admin logo in Magento 2 for branding purposes.
Any doubts about the custom admin theme and how to apply it?
If so, feel free to mention them in the Comments section below.
I’d be happy to help.
Do share the post with the Magento community via social media.
Sanjay Jethva
Sanjay is the co-founder and CTO of Meetanshi with hands-on expertise with Magento since 2011. He specializes in complex development, integrations, extensions, and customizations. Sanjay is one the top 50 contributor to the Magento community and is recognized by Adobe.
His passion for Magento 2 and Shopify solutions has made him a trusted source for businesses seeking to optimize their online stores. He loves sharing technical solutions related to Magento 2 & Shopify.
2 Comments
Hi,
I did all the steps, but I am getting this error
1 exception(s):
Exception #0 (LogicException): Could not create an acl object: Invalid Document
Element ‘resource’: The attribute ‘title’ is required but missing.
Line: 26
Exception #0 (LogicException): Could not create an acl object: Invalid Document
Element ‘resource’: The attribute ‘title’ is required but missing.
Line: 26
Hey Mohsen,
It is related to acl file issue in any 3rd part extension,
Please check acl.xml file if you have created any.