get_stylesheet_uri

函式
get_stylesheet_uri ( No parameters )
返回值
  • (string) URI to active theme's stylesheet.
定義位置
相關方法
get_stylesheetget_locale_stylesheet_uriget_stylesheet_directory_uriget_stylesheet_directoryget_theme_root_uri
引入
1.5.0
棄用
-

get_stylesheet_uri: 這個函式可以檢索到當前主題的樣式表檔案的URL。它不接受任何引數,並以字串的形式返回URL。

檢索活動主題的樣式表URI。

樣式表的檔名是’style.css’,它被附加到樣式表目錄URI路徑上。參見get_stylesheet_directory_uri()。

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
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 );
}
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 ); }
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 );
}

常見問題

FAQs
檢視更多 >