
WordPress预发布环境初学者指南
get_stylesheet_uri ( No parameters )
get_stylesheet_uri: 这个函数可以检索到当前主题的样式表文件的URL。它不接受任何参数,并以字符串的形式返回URL。
检索活动主题的样式表URI。
样式表的文件名是’style.css’,它被附加到样式表目录URI路径上。参见get_stylesheet_directory_uri()。
function get_stylesheet_uri() { $stylesheet_dir_uri = get_stylesheet_directory_uri(); $stylesheet_uri = $stylesheet_dir_uri . '/style.css'; /** * Filters the URI of the active theme stylesheet. * * @since 1.5.0 * * @param string $stylesheet_uri Stylesheet URI for the active theme/child theme. * @param string $stylesheet_dir_uri Stylesheet directory URI for the active theme/child theme. */ return apply_filters( 'stylesheet_uri', $stylesheet_uri, $stylesheet_dir_uri ); }