返回介绍

get_stylesheet_directory_uri()

发布于 2017-09-11 00:14:49 字数 3331 浏览 1146 评论 0 收藏 0

get_stylesheet_directory_uri()

Retrieve stylesheet directory URI.


description


返回值

(string)


源代码

File: wp-includes/theme.php

function get_stylesheet_directory_uri() {
	$stylesheet = str_replace( '%2F', '/', rawurlencode( get_stylesheet() ) );
	$theme_root_uri = get_theme_root_uri( $stylesheet );
	$stylesheet_dir_uri = "$theme_root_uri/$stylesheet";

	/**
	 * Filters the stylesheet directory URI.
	 *
	 * @since 1.5.0
	 *
	 * @param string $stylesheet_dir_uri Stylesheet directory URI.
	 * @param string $stylesheet         Name of the activated theme's directory.
	 * @param string $theme_root_uri     Themes root URI.
	 */
	return apply_filters( 'stylesheet_directory_uri', $stylesheet_dir_uri, $stylesheet, $theme_root_uri );
}

更新日志

Versiondescription
1.5.0Introduced.

相关函数

Uses

  • wp-includes/theme.php: get_theme_root_uri()
  • wp-includes/theme.php: stylesheet_directory_uri
  • wp-includes/theme.php: get_stylesheet()
  • wp-includes/plugin.php: apply_filters()

Used By

  • wp-includes/link-template.php: get_theme_file_uri()
  • wp-includes/theme.php: get_editor_stylesheets()
  • wp-admin/custom-header.php: Custom_Image_Header::get_default_header_images()
  • wp-admin/custom-header.php: Custom_Image_Header::step_1()
  • wp-admin/custom-header.php: Custom_Image_Header::reset_header_image()
  • wp-admin/custom-header.php: Custom_Image_Header::process_default_headers()
  • wp-includes/class-wp-customize-manager.php: WP_Customize_Manager::register_controls()
  • wp-includes/theme.php: _get_random_header_data()
  • wp-includes/theme.php: get_custom_header()
  • wp-includes/theme.php: get_theme_mod()
  • wp-includes/theme.php: get_stylesheet_uri()
  • wp-includes/theme.php: get_locale_stylesheet_uri()
  • wp-includes/general-template.php: get_bloginfo()
  • Show 8 more used by Hide more used by

User Contributed Notes

  1. Skip to note content You must log in to vote on the helpfulness of this noteVote results for this note: 2You must log in to vote on the helpfulness of this note Contributed by Florian Simeth

    This function returns the URL to the current child theme if a child theme is used. If you want to return the URL to the root/mother theme, use get_template_directory_uri() instead.

  2. Image (HTML)

    
    <img src="<?php echo get_stylesheet_directory_uri(); ?>/images/aternus.png" alt="" width="" height="" />
    
    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文