apply_filters( 'stylesheet_uri', string $stylesheet_uri , string $stylesheet_dir_uri )
Filters the URI of the current theme stylesheet.
Description Description
Parameters Parameters
- $stylesheet_uri
-
(string) Stylesheet URI for the current theme/child theme.
- $stylesheet_dir_uri
-
(string) Stylesheet directory URI for the current theme/child theme.
Source Source
File: wp-includes/theme.php
Changelog Changelog
| Version | Description |
|---|---|
| 1.5.0 | Introduced. |
User Contributed Notes User Contributed Notes
You must log in before being able to contribute a note or feedback.
Use a custom stylesheet for single posts.
/** * Use a custom stylesheet for single posts. * * @param string $stylesheet Original stylesheet URI. * @param string $stylesheet_dir Stylesheet directory. * @return string (Maybe modified) stylesheet URI. */ function wpdocs_custom_stylesheet_for_single_posts( $stylesheet, $stylesheet_dir ) { if ( is_singular( 'post' ) ) { $stylesheet = $stylesheet_dir . '/custom-single.css'; } return $stylesheet; } add_filter( 'stylesheet_uri', 'wpdocs_custom_stylesheet_for_single_posts', 10, 2 );Expand full source codeCollapse full source code