wp_style_loader_src

Administration Screen CSS for changing the styles.

Description

(string|false) wp_style_loader_src( (string) $src, (string) $handle ); 

If installing the wp-admin/ directory will be replaced with ./..

The $_wp_admin_css_colors global manages the Administration Screens CSS stylesheet that is loaded. The option that is set is admin_color and is the color and key for the array. The value for the color key is an object with a url parameter that has the URL path to the CSS file.

The query from $src parameter will be appended to the URL that is given from the $_wp_admin_css_colors array value URL.

Returns (string|false)

URL path to CSS stylesheet for Administration Screens.

Parameters (2)

0. $src (string)
Source URL.
1. $handle (string)
Either colors or colors-rtl..

Usage

  1. if ( !function_exists( 'wp_style_loader_src' ) ) { 
  2. require_once ABSPATH . WPINC . '/script-loader.php'; 
  3.  
  4. // Source URL. 
  5. $src = ''; 
  6.  
  7. // Either 'colors' or 'colors-rtl'. 
  8. $handle = ''; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = wp_style_loader_src($src, $handle); 
  12.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/script-loader.php  
  1. function wp_style_loader_src( $src, $handle ) { 
  2. global $_wp_admin_css_colors; 
  3.  
  4. if ( wp_installing() ) 
  5. return preg_replace( '#^wp-admin/#', './', $src ); 
  6.  
  7. if ( 'colors' == $handle ) { 
  8. $color = get_user_option('admin_color'); 
  9.  
  10. if ( empty($color) || !isset($_wp_admin_css_colors[$color]) ) 
  11. $color = 'fresh'; 
  12.  
  13. $color = $_wp_admin_css_colors[$color]; 
  14. $url = $color->url; 
  15.  
  16. if ( ! $url ) { 
  17. return false; 
  18.  
  19. $parsed = parse_url( $src ); 
  20. if ( isset($parsed['query']) && $parsed['query'] ) { 
  21. wp_parse_str( $parsed['query'], $qv ); 
  22. $url = add_query_arg( $qv, $url ); 
  23.  
  24. return $url; 
  25.  
  26. return $src;