WordPress.org

Make WordPress Core

Ticket #30797: 30797.2.patch

File 30797.2.patch, 1.2 KB (added by grapplerulrich, 4 years ago)

Returns URI or false

  • wp-includes/theme.php

     
    233233}
    234234
    235235/**
     236 * Retrieve URI of current parent stylesheet.
     237 *
     238 * The stylesheet file name is 'style.css' which is appended to {@link
     239 * get_template_directory_uri() template directory URI} path.
     240 *
     241 * @since 4.4.0
     242 *
     243 * @return string|bool URI to current parent stylesheet or false if no child theme is avtivated.
     244 */
     245function get_parent_stylesheet_uri() {
     246        if ( ! is_child_theme() ) {
     247                return false;
     248        }
     249        $template_dir_uri      = get_template_directory_uri();
     250        $parent_stylesheet_uri = $template_dir_uri . '/style.css';
     251        /**
     252         * Filter the URI of the current parent stylesheet.
     253         *
     254         * @since 4.4.0
     255         *
     256         * @param string $template_uri          Template URI for the current theme/parent theme.
     257         * @param string $parent_stylesheet_uri Template directory URI for the current theme/parent theme.
     258         */
     259        return apply_filters( 'parent_stylesheet_uri', $parent_stylesheet_uri, $template_dir_uri );
     260}
     261
     262/**
    236263 * Retrieve localized stylesheet URI.
    237264 *
    238265 * The stylesheet directory for the localized stylesheet files are located, by