Create an Admin theme

1.Create Admin theme directory
In the app/design/adminhtml directory create a new <Vendor>/<admin_theme> directory.

2.Add a declaration theme.xml
Add or copy from an existing theme.xml to your theme directory app/design/adminhtml/Vendor/<admin_theme>

<theme xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Config/etc/theme.xsd">
	<title>Ataur Admin</title> <!-- your theme's name -->
	<parent>Magento/backend</parent> <!-- the parent theme. Example: Magento/backend -->
</theme>	

3.Add registration.php
In your theme directory app/design/adminhtml/<Vendor>/<admin_theme> create a registration.php file.

<?php
/**
 * Copyright © 2016 Magento. All rights reserved.
 * See COPYING.txt for license details.
 */
\Magento\Framework\Component\ComponentRegistrar::register(
	\Magento\Framework\Component\ComponentRegistrar::THEME,
	'adminhtml/Ataur/my-first-admin-theme', // Example: 'adminhtml/Magento/backend'
	__DIR__
); 

4.Admin theme logo
In the default Magento/backend theme lib/web/images/magento-logo.svg is used as theme logo. To override it, in your theme directory, create a web/images sub-directory, and add your custom file named magento-logo.svg

5.Apply an Admin theme
Prerequisites:
1.Set your Magento application to the developer mode.
2.Create a custom theme for the Admin panel.
3.Add a new custom module or decide to use existing custom module. The module must load after the Magento_Theme module. To ensure this, add the following code app/code/[VendorName]/[ModuleName]/etc/module.xml

(replace placeholders with your module information):

<module name="Ataur_Override" setup_version="2.0.1"> <!-- Example: "Magento_Backend -->"
	<sequence>
		<module name="Magento_Theme"/>
	</sequence>
</module>

6.Specify the custom Admin theme in di.xml
You need to specify the admin theme to be used in the <your_module_dir>/etc/di.xml file. Add it, if the file does not yet exist in your module.

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
	<!-- Admin theme. Start -->
	<type name="Magento\Theme\Model\View\Design">
		<arguments>
			 <argument name="themes" xsi:type="array">
				 <item name="adminhtml" xsi:type="string">Ataur/my-first-admin-theme</item> <!-- Example: "Magento/backend" -->
			 </argument>
		 </arguments> 
	</type>
	<!-- Admin theme. End -->
</config>

7.Update components to actually apply the Admin theme
For your changes to take effect, you need to update Magento components. For this,
run the php bin/magento setup:upgrade command in your command line. If prompted, also run
php bin/magento setup:di:compile

error face: Controller preference not working after setup:di:compile
solution: Have you tried to run php bin/magento setup:static-content:deploy afterwards?
And just in case, run again php bin/magento setup:upgrade at the very end of operations.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s