Home > Backend Development > PHP Tutorial > Tips for customizing the color scheme of the background management interface in WordPress, wordpress color scheme_PHP tutorial

Tips for customizing the color scheme of the background management interface in WordPress, wordpress color scheme_PHP tutorial

WBOY
Release: 2016-07-12 09:02:04
Original
1191 people have browsed it

Tips for customizing the color scheme of the backend management interface in WordPress, wordpress color scheme

The newly designed backend starting with WordPress 3.8 supports multi-color selection, and the default is eight very beautiful Color matching allows users to choose.

20151229153747630.png (1114×256)

About color matching WordPress provides a function wp_admin_css_color() that allows developers to customize color matching. All registration operations can be completed by just calling this function.

Parameters

    wp_admin_css_color( $key, $name, $url, $colors = array(), $icons = array() );
    
    
    Copy after login
  • $key (string): ID of color
  • $name (string): the name of the color, displayed in the background
  • $url(string): CSS referenced when selecting this color
  • $colors (array): The demo colors under the name when the user selects a color. You can set unlimited numbers, 4 are recommended. The default value is an empty array
  • $icons (array): The color of the SVG icon, which can be set to an array with a length of 3. The key values ​​are base, focus and current. The default value is an empty array

Example

First you need to prepare a CSS file. This CSS file stores the CSS that is called when the user selects your color scheme, that is, the CSS that stores the color matching style. You can completely customize it, or directly copy the default one that comes with WordPress. Modify the color CSS (/wp-admin/css/colors.min.css).

Then you can register it in the PHP file. Let’s look at an example first. This example creates a function and mounts it to admin_init, and then adds colors to it.

/***
 *创建后台自定义配色
 *http://www.endskin.com/add-admin-color/
*/
function Bing_add_admin_color(){
 wp_admin_css_color(
  'Bing',
  '自定义',
  get_bloginfo( 'template_directory' ) . '/color_style.css',
  array( 'red', '#AAA', '#FEFEFE', '#000' ),
  array( 'base' => '#999', 'focus' => '#2ea2cc', 'current' => '#fff' )
 );
}
add_action( 'admin_init', 'Bing_add_admin_color' );
Copy after login

Location

The file where the function is located:/wp-includes/general-template.php

Articles you may be interested in:

  • Analysis of related functions for sending http requests in WordPress
  • How to set default content in WordPress article editor
  • Explanation of PHP functions used to create and obtain sidebars in WordPress
  • Detailed explanation of how to use functions to add and perform actions in WordPress

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/1086650.htmlTechArticleTips for customizing the color scheme of the backend management interface in WordPress, the newly designed backend starting from WordPress 3.8. Supports multiple color selections, the default eight are very beautiful...
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template