WordPress.org

Make WordPress Core

Ticket #18302: 18302.15.diff

File 18302.15.diff, 1.5 KB (added by gma992, 5 years ago)

link-template.php needed refresh, nothing new added

  • src/wp-includes/link-template.php

     
    24382438}
    24392439
    24402440/**
     2441 * Retrieve the url of a file in the theme.
     2442 *
     2443 * Searches in the stylesheet directory before the template directory so themes
     2444 * which inherit from a parent theme can just override one file.
     2445 *
     2446 * @since 3.6.0
     2447 *
     2448 * @param string $file File to search for in the stylesheet directory.
     2449 * @return string The URL of the file.
     2450 */
     2451function theme_file_uri( $file = '' ) {
     2452        $file = ltrim( $file, '/' );
     2453
     2454        if ( empty( $file ) ) {
     2455                $url = get_stylesheet_directory_uri();
     2456        } elseif( is_child_theme() && file_exists( get_stylesheet_directory() . "/$file" ) ) {
     2457                $url = get_stylesheet_directory_uri() . "/$file";
     2458        } else {
     2459                $url = get_template_directory_uri() . "/$file";
     2460        }
     2461
     2462        return apply_filters( 'theme_url', $url, $file );
     2463}
     2464
     2465/**
     2466 * Retrieve the url of a file in the parent theme.
     2467 *
     2468 * @since 3.6.0
     2469 *
     2470 * @param string $file File to return the url for in the template directory.
     2471 * @return string The URL of the file.
     2472 */
     2473function parent_theme_file_uri( $file = '' ) {
     2474        $file = ltrim( $file, '/' );
     2475
     2476        if ( empty( $file ) ) {
     2477                $url = get_template_directory_uri();
     2478        } else {
     2479                $url = get_template_directory_uri() . "/$file";
     2480        }
     2481
     2482        return apply_filters( 'parent_theme_url', $url, $file );
     2483}
     2484/**
    24412485 * Displays the navigation to next/previous post, when applicable.
    24422486 *
    24432487 * @since 4.1.0