Ticket #18302: 18302.theme_url.8.diff
File 18302.theme_url.8.diff, 7.7 KB (added by , 12 years ago) |
---|
-
wp-includes/link-template.php
2095 2095 } 2096 2096 2097 2097 /** 2098 * Retrieve the url of the template file. 2099 * 2100 * Searches in the stylesheet directory before the template directory so themes 2101 * which inherit from a parent theme can just overload one file. 2102 * 2103 * @since 3.5.0 2104 * 2105 * @param string $template_names Template file to search for. 2106 * @return string The URI of the file if one is located. 2107 */ 2108 function theme_url( $file = '' ) { 2109 $file = ltrim( $file, '/' ); 2110 2111 if ( empty( $file ) || ( false !== strpos( $file, '..' ) ) ) { 2112 $url = get_stylesheet_directory_uri(); 2113 } elseif ( is_child_theme() && file_exists( trailingslashit( get_stylesheet_directory() ) . $file ) ) { 2114 $url = trailingslashit( get_stylesheet_directory_uri() ) . $file; 2115 } else { 2116 $url = trailingslashit( get_template_directory_uri() ) . $file; 2117 } 2118 2119 return apply_filters( 'theme_url', $url, $file ); 2120 } 2121 2122 /** 2098 2123 * Retrieve the site url for the current network. 2099 2124 * 2100 2125 * Returns the site url with the appropriate protocol, 'https' if -
wp-content/themes/twentytwelve/header.php
22 22 <link rel="profile" href="http://gmpg.org/xfn/11" /> 23 23 <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> 24 24 <!--[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> 26 26 <![endif]--> 27 27 <?php wp_head(); ?> 28 28 </head> -
wp-content/themes/twentytwelve/functions.php
104 104 * JavaScript for handling navigation menus and the resized 105 105 * styles for small screen sizes. 106 106 */ 107 wp_enqueue_script( 'twentytwelve-navigation', get_template_directory_uri() . '/js/theme.js', array( 'jquery' ), '20120802', true );107 wp_enqueue_script( 'twentytwelve-navigation', theme_url( 'js/theme.js' ), array( 'jquery' ), '20120802', true ); 108 108 109 109 /** 110 110 * Load special font CSS file. -
wp-content/themes/twentytwelve/inc/theme-options.php
241 241 * @return void 242 242 */ 243 243 public function customize_preview_js() { 244 wp_enqueue_script( 'twentytwelve-customizer', get_template_directory_uri() . '/js/theme-customizer.js', array( 'customize-preview' ), '20120802', true );244 wp_enqueue_script( 'twentytwelve-customizer', theme_url( 'js/theme-customizer.js' ), array( 'customize-preview' ), '20120802', true ); 245 245 wp_localize_script( 'twentytwelve-customizer', 'twentytwelve_customizer', array( 246 246 'option_key' => $this->option_key, 247 247 'link' => $this->custom_fonts_url(), -
wp-content/themes/twentyeleven/showcase.php
15 15 */ 16 16 17 17 // Enqueue showcase script for the slider 18 wp_enqueue_script( 'twentyeleven-showcase', get_template_directory_uri() . '/js/showcase.js', array( 'jquery' ), '2011-04-28' );18 wp_enqueue_script( 'twentyeleven-showcase', theme_url( 'js/showcase.js' ), array( 'jquery' ), '2011-04-28' ); 19 19 20 20 get_header(); ?> 21 21 -
wp-content/themes/twentyeleven/header.php
49 49 <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" /> 50 50 <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" /> 51 51 <!--[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> 53 53 <![endif]--> 54 54 <?php 55 55 /* We add some JavaScript to pages with the comment form -
wp-content/themes/twentyeleven/inc/theme-options.php
16 16 * 17 17 */ 18 18 function 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' ); 21 21 wp_enqueue_style( 'farbtastic' ); 22 22 } 23 23 add_action( 'admin_print_styles-appearance_page_theme_options', 'twentyeleven_admin_enqueue_scripts' ); … … 147 147 'light' => array( 148 148 'value' => 'light', 149 149 'label' => __( 'Light', 'twentyeleven' ), 150 'thumbnail' => get_template_directory_uri() . '/inc/images/light.png',150 'thumbnail' => theme_url( 'inc/images/light.png' ), 151 151 'default_link_color' => '#1b8be0', 152 152 ), 153 153 'dark' => array( 154 154 'value' => 'dark', 155 155 'label' => __( 'Dark', 'twentyeleven' ), 156 'thumbnail' => get_template_directory_uri() . '/inc/images/dark.png',156 'thumbnail' => theme_url( 'inc/images/dark.png' ), 157 157 'default_link_color' => '#e4741f', 158 158 ), 159 159 ); … … 171 171 'content-sidebar' => array( 172 172 'value' => 'content-sidebar', 173 173 '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' ), 175 175 ), 176 176 'sidebar-content' => array( 177 177 'value' => 'sidebar-content', 178 178 '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' ), 180 180 ), 181 181 'content' => array( 182 182 'value' => 'content', 183 183 'label' => __( 'One-column, no sidebar', 'twentyeleven' ), 184 'thumbnail' => get_template_directory_uri() . '/inc/images/content.png',184 'thumbnail' => theme_url( 'inc/images/content.png' ), 185 185 ), 186 186 ); 187 187 … … 362 362 $color_scheme = $options['color_scheme']; 363 363 364 364 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 ); 366 366 367 367 do_action( 'twentyeleven_enqueue_color_scheme', $color_scheme ); 368 368 } … … 526 526 * @since Twenty Eleven 1.3 527 527 */ 528 528 function 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 ); 530 530 } 531 531 add_action( 'customize_preview_init', 'twentyeleven_customize_preview_js' ); 532 No newline at end of file