Home  >  Article  >  CMS Tutorial  >  How to add new colors to WordPress backend admin interface

How to add new colors to WordPress backend admin interface

藏色散人
藏色散人forward
2019-11-20 11:02:312810browse

The following column WordPress Tutorial will introduce to you how to add new colors to the WordPress backend management interface. I hope it will be helpful to friends in need!

How to add new colors to WordPress backend admin interface

Starting from WordPress version 3.8, the backend management interface adopts the popular flat UI design. The backend-user-my profile page provides eight types of management by default. The interface color scheme is available for users to choose, but they always feel that it does not suit their needs. The almighty WordPress has also taken this into consideration and has preset a function for us to add custom colors.

This function is located at line 3839 of the /wp-includes/general-template.php file:

Allows a plugin to register a new admin colour scheme. For example:
wp_admin_css_color( 'classic', __( 'Classic' ), admin_url( "css/colors-classic.css" ), array(
'#07273E', '#14568A', '#D54E21', '#2683AE'
) );

With the ready-made function, it will be easier to handle.

The first step is to create a new folder named css in the current theme, and copy the colors.css in any folder in the wordpress\wp-admin\css\colors directory to this css folder.

The second step, add the following code to the current theme functions.php:

// 添加后台配色
wp_admin_css_color( 
 'my_css', __( '新的配色' ), // 文字可以修改
 get_template_directory_uri() . '/css/colors.css', 
array( '#21252e', '#2f3541', '#3078ab', '#3690cf' ),
array( 'base' => '#e5f8ff', 'focus' => '#fff', 'current' => '#fff' )
);

The third step, modify the color value in colors.css to what you like.

It should be noted that during the process of modifying the style, you must clear the browser cache at any time to see the effect of the modification.

By analogy, multiple custom color schemes can be added.

Using the above method, you can theoretically modify any style in the background, including hiding some unnecessary functions through display: none.

The effect after adding:

How to add new colors to WordPress backend admin interface

The above is the detailed content of How to add new colors to WordPress backend admin interface. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:zmingcx.com. If there is any infringement, please contact admin@php.cn delete