get_locale_stylesheet_uri

Retrieves the localized stylesheet URI.

Description

(string) get_locale_stylesheet_uri(); 

The stylesheet directory for the localized stylesheet files are located, by default, in the base theme directory. The name of the locale file will be the locale followed by .css.. If that does not exist, then the text direction stylesheet will be checked for existence, for example ltr.css.

The theme may change the location of the stylesheet directory by either using the or filters.

If you want to change the location of the stylesheet files for the entire WordPress workflow, then change the former. If you just have the locale in a separate folder, then change the latter.

Returns (string)


Usage

  1. if ( !function_exists( 'get_locale_stylesheet_uri' ) ) { 
  2. require_once ABSPATH . WPINC . '/theme.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = get_locale_stylesheet_uri(); 
  7.  

Defined (1)

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

/wp-includes/theme.php  
  1. function get_locale_stylesheet_uri() { 
  2. global $wp_locale; 
  3. $stylesheet_dir_uri = get_stylesheet_directory_uri(); 
  4. $locale = get_locale(); 
  5. if ( file_exists("$dir/$locale.css") ) 
  6. $stylesheet_uri = "$stylesheet_dir_uri/$locale.css"; 
  7. elseif ( !empty($wp_locale->text_direction) && file_exists("$dir/{$wp_locale->text_direction}.css") ) 
  8. $stylesheet_uri = "$stylesheet_dir_uri/{$wp_locale->text_direction}.css"; 
  9. else 
  10. $stylesheet_uri = ''; 
  11. /** 
  12. * Filters the localized stylesheet URI. 
  13. * @since 2.1.0 
  14. * @param string $stylesheet_uri Localized stylesheet URI. 
  15. * @param string $stylesheet_dir_uri Stylesheet directory URI. 
  16. */ 
  17. return apply_filters( 'locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri );