检索本地化的样式表URI。
原型
get_locale_stylesheet_uri()
描述
默认情况下,本地化样式表文件的样式表目录位于基本主题目录中。语言环境文件的名称将是后跟“.css”的语言环境。如果不存在,则将检查文本方向样式表是否存在,例如’ltr.css’。
返回值
(string)
源文件
路径:wp-includes/theme.php
<?php
...
function get_locale_stylesheet_uri() {
global $wp_locale;
$stylesheet_dir_uri = get_stylesheet_directory_uri();
$dir = get_stylesheet_directory();
$locale = get_locale();
if ( file_exists("$dir/$locale.css") )
$stylesheet_uri = "$stylesheet_dir_uri/$locale.css";
elseif ( !empty($wp_locale->text_direction) && file_exists("$dir/{$wp_locale->text_direction}.css") )
$stylesheet_uri = "$stylesheet_dir_uri/{$wp_locale->text_direction}.css";
else
$stylesheet_uri = '';
/**
* Filters the localized stylesheet URI.
*
* @since 2.1.0
*
* @param string $stylesheet_uri Localized stylesheet URI.
* @param string $stylesheet_dir_uri Stylesheet directory URI.
*/
return apply_filters( 'locale_stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri );
}
...
?>
其他
英文文档:https://developer.wordpress.org/reference/functions/get_locale_stylesheet_uri/