WordPress.org

Make WordPress Core

Ticket #18302: 18302.10.diff

File 18302.10.diff, 7.7 KB (added by georgestephanis, 6 years ago)
  • wp-includes/link-template.php

     
    20712071}
    20722072
    20732073/**
     2074 * Retrieve the url of the template file.
     2075 *
     2076 * Searches in the stylesheet directory before the template directory so themes
     2077 * which inherit from a parent theme can just overload one file.
     2078 *
     2079 * @since 3.5.0
     2080 *
     2081 * @param string $file Template file to search for.
     2082 * @param boolean $overrideable Template file to search for.
     2083 * @return string The URI of the file if one is located.
     2084 */
     2085function theme_url( $file = '', $overrideable = true ) {
     2086        $file = ltrim( $file, '/' );
     2087
     2088        if( $question_mark_pos = strpos( $file, '?' ) ){
     2089                $_get_string = substr( $file, $question_mark_pos );
     2090                $file = substr( $file, 0, $question_mark_pos );
     2091        }
     2092
     2093        if ( empty( $file ) || ( false !== strpos( $file, '..' ) ) ) {
     2094                $url = get_stylesheet_directory_uri();
     2095        } elseif ( $overrideable && is_child_theme() && file_exists( trailingslashit( get_stylesheet_directory() ) . $file ) ) {
     2096                $url = trailingslashit( get_stylesheet_directory_uri() ) . $file;
     2097        } else {
     2098                $url = trailingslashit( get_template_directory_uri() ) . $file;
     2099        }
     2100
     2101        if( ! empty( $_get_string ) ){
     2102                $url .= $_get_string;
     2103        }
     2104
     2105        return apply_filters( 'theme_url', $url, $file, $overrideable );
     2106}
     2107
     2108/**
    20742109 * Retrieve the site url for the current network.
    20752110 *
    20762111 * Returns the site url with the appropriate protocol, 'https' if
  • wp-content/themes/twentytwelve/header.php

     
    2222<link rel="profile" href="http://gmpg.org/xfn/11" />
    2323<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    2424<!--[if lt IE 9]>
    25 <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
     25<script src="<?php echo theme_url( 'js/html5.js' ); ?>" type="text/javascript"></script>
    2626<![endif]-->
    2727<?php wp_head(); ?>
    2828</head>
  • wp-content/themes/twentytwelve/functions.php

     
    9898        /*
    9999         * Adds JavaScript for handling the navigation menu hide-and-show behavior.
    100100         */
    101         wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120824', true );
     101        wp_enqueue_script( 'twentytwelve-navigation', theme_url( '/js/navigation.js' ), array(), '20120824', true );
    102102
    103103        /*
    104104         * Loads our special font CSS file.
     
    427427 * @since Twenty Twelve 1.0
    428428 */
    429429function twentytwelve_customize_preview_js() {
    430         wp_enqueue_script( 'twentytwelve-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20120827', true );
     430        wp_enqueue_script( 'twentytwelve-customizer', theme_url( 'js/theme-customizer.js' ), array( 'customize-preview' ), '20120827', true );
    431431}
    432432add_action( 'customize_preview_init', 'twentytwelve_customize_preview_js' );
  • wp-content/themes/twentyeleven/showcase.php

     
    1515 */
    1616
    1717// Enqueue showcase script for the slider
    18 wp_enqueue_script( 'twentyeleven-showcase', get_template_directory_uri() . '/js/showcase.js', array( 'jquery' ), '2011-04-28' );
     18wp_enqueue_script( 'twentyeleven-showcase', theme_url( 'js/showcase.js' ), array( 'jquery' ), '2011-04-28' );
    1919
    2020get_header(); ?>
    2121
  • wp-content/themes/twentyeleven/header.php

     
    4949<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />
    5050<link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />
    5151<!--[if lt IE 9]>
    52 <script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script>
     52<script src="<?php echo theme_url( 'js/html5.js' ); ?>" type="text/javascript"></script>
    5353<![endif]-->
    5454<?php
    5555        /* We add some JavaScript to pages with the comment form
  • wp-content/themes/twentyeleven/inc/theme-options.php

     
    1616 *
    1717 */
    1818function twentyeleven_admin_enqueue_scripts( $hook_suffix ) {
    19         wp_enqueue_style( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.css', false, '2011-04-28' );
    20         wp_enqueue_script( 'twentyeleven-theme-options', get_template_directory_uri() . '/inc/theme-options.js', array( 'farbtastic' ), '2011-06-10' );
     19        wp_enqueue_style( 'twentyeleven-theme-options', theme_url( 'inc/theme-options.css' ), false, '2011-04-28' );
     20        wp_enqueue_script( 'twentyeleven-theme-options', theme_url( 'inc/theme-options.js' ), array( 'farbtastic' ), '2011-06-10' );
    2121        wp_enqueue_style( 'farbtastic' );
    2222}
    2323add_action( 'admin_print_styles-appearance_page_theme_options', 'twentyeleven_admin_enqueue_scripts' );
     
    147147                'light' => array(
    148148                        'value' => 'light',
    149149                        'label' => __( 'Light', 'twentyeleven' ),
    150                         'thumbnail' => get_template_directory_uri() . '/inc/images/light.png',
     150                        'thumbnail' => theme_url( 'inc/images/light.png' ),
    151151                        'default_link_color' => '#1b8be0',
    152152                ),
    153153                'dark' => array(
    154154                        'value' => 'dark',
    155155                        'label' => __( 'Dark', 'twentyeleven' ),
    156                         'thumbnail' => get_template_directory_uri() . '/inc/images/dark.png',
     156                        'thumbnail' => theme_url( 'inc/images/dark.png' ),
    157157                        'default_link_color' => '#e4741f',
    158158                ),
    159159        );
     
    171171                'content-sidebar' => array(
    172172                        'value' => 'content-sidebar',
    173173                        'label' => __( 'Content on left', 'twentyeleven' ),
    174                         'thumbnail' => get_template_directory_uri() . '/inc/images/content-sidebar.png',
     174                        'thumbnail' => theme_url( 'inc/images/content-sidebar.png' ),
    175175                ),
    176176                'sidebar-content' => array(
    177177                        'value' => 'sidebar-content',
    178178                        'label' => __( 'Content on right', 'twentyeleven' ),
    179                         'thumbnail' => get_template_directory_uri() . '/inc/images/sidebar-content.png',
     179                        'thumbnail' => theme_url( 'inc/images/sidebar-content.png' ),
    180180                ),
    181181                'content' => array(
    182182                        'value' => 'content',
    183183                        'label' => __( 'One-column, no sidebar', 'twentyeleven' ),
    184                         'thumbnail' => get_template_directory_uri() . '/inc/images/content.png',
     184                        'thumbnail' => theme_url( 'inc/images/content.png' ),
    185185                ),
    186186        );
    187187
     
    362362        $color_scheme = $options['color_scheme'];
    363363
    364364        if ( 'dark' == $color_scheme )
    365                 wp_enqueue_style( 'dark', get_template_directory_uri() . '/colors/dark.css', array(), null );
     365                wp_enqueue_style( 'dark', theme_url( 'colors/dark.css' ), array(), null );
    366366
    367367        do_action( 'twentyeleven_enqueue_color_scheme', $color_scheme );
    368368}
     
    526526 * @since Twenty Eleven 1.3
    527527 */
    528528function twentyeleven_customize_preview_js() {
    529         wp_enqueue_script( 'twentyeleven-customizer', get_template_directory_uri() . '/inc/theme-customizer.js', array( 'customize-preview' ), '20120523', true );
     529        wp_enqueue_script( 'twentyeleven-customizer', theme_url( 'inc/theme-customizer.js' ), array( 'customize-preview' ), '20120523', true );
    530530}
    531531add_action( 'customize_preview_init', 'twentyeleven_customize_preview_js' );
     532 No newline at end of file