get_stylesheet_directory_uri() - WordPress 函数参考中文文档

返回介绍

get_stylesheet_directory_uri()

发布于 2017-09-11 字数3331 浏览 958 评论 0

get_stylesheet_directory_uri()

Retrieve stylesheet directory URI.


描述


返回值

(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 );
}

更新日志

Version 描述
1.5.0 Introduced.

相关函数

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="" />
    
    

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!