WordPress.org

Codex

Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get stylesheet directory uri

Description

Retrieve stylesheet directory URI for the current theme/child theme. Checks for SSL.

Note: Does not contain a trailing slash.

Note that this returns a properly-formed URI; in other words, it will be a web-address (starting with http:// or https:// for SSL). As such, it is most appropriately used for links, referencing additional stylesheets, or probably most commonly, images.

In the event a child theme is being used, this function will return the child's theme directory URI. Use get_template_directory_uri() to avoid being overridden by a child theme.

If you want to include a local file in PHP, use get_stylesheet_directory() instead.

Usage

Use the URI <?php get_stylesheet_directory_uri(); ?> Output the URI <?php echo get_stylesheet_directory_uri(); ?>

Parameters

None.

Return Values

uri (string) 
Stylesheet directory URI.

Examples

Image (HTML)

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

Notes

Change Log

Source File

get_stylesheet_directory_uri() is located in wp-includes/theme.php.

Related


Theme paths: get_template(), get_template_directory(), get_template_directory_uri(), get_theme_roots(), get_theme_root(), get_theme_root_uri(), get_stylesheet(), get_stylesheet_uri(), get_stylesheet_directory(), get_stylesheet_directory_uri(), get_bloginfo(), get_theme_file_uri(), get_theme_file_path()

See also index of Function Reference and index of Template Tags.