| 1 | Index: wp-includes/link-template.php |
|---|
| 2 | =================================================================== |
|---|
| 3 | --- wp-includes/link-template.php (revision 21078) |
|---|
| 4 | +++ wp-includes/link-template.php (working copy) |
|---|
| 5 | @@ -2059,6 +2059,36 @@ |
|---|
| 6 | } |
|---|
| 7 | |
|---|
| 8 | /** |
|---|
| 9 | + * Retrieve the url of the highest priority template file that exists. |
|---|
| 10 | + * |
|---|
| 11 | + * Searches in the stylesheet directory before the template directory so themes |
|---|
| 12 | + * which inherit from a parent theme can just overload one file. |
|---|
| 13 | + * |
|---|
| 14 | + * @since 3.5 |
|---|
| 15 | + * |
|---|
| 16 | + * @param string|array $template_names Template file(s) to search for, in order. |
|---|
| 17 | + * @return string The URI of the file if one is located. |
|---|
| 18 | + */ |
|---|
| 19 | +function theme_url( $template_names ) { |
|---|
| 20 | + $located = null; |
|---|
| 21 | + |
|---|
| 22 | + foreach ( (array) $template_names as $template_name ) { |
|---|
| 23 | + $template_name = ltrim( $template_name, '/' ); |
|---|
| 24 | + if ( ! $template_name ) |
|---|
| 25 | + continue; |
|---|
| 26 | + if ( file_exists( get_stylesheet_directory() . '/' . $template_name ) ) { |
|---|
| 27 | + $located = get_stylesheet_directory_uri() . '/' . $template_name; |
|---|
| 28 | + break; |
|---|
| 29 | + } elseif ( file_exists( get_template_directory() . '/' . $template_name ) ) { |
|---|
| 30 | + $located = get_template_directory_uri() . '/' . $template_name; |
|---|
| 31 | + break; |
|---|
| 32 | + } |
|---|
| 33 | + } |
|---|
| 34 | + |
|---|
| 35 | + return $located; |
|---|
| 36 | +} |
|---|
| 37 | + |
|---|
| 38 | +/** |
|---|
| 39 | * Retrieve the site url for the current network. |
|---|
| 40 | * |
|---|
| 41 | * Returns the site url with the appropriate protocol, 'https' if |
|---|