Changeset 20015
- Timestamp:
- 02/28/2012 04:22:26 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/theme.php
r20002 r20015 476 476 477 477 if ( count($wp_theme_directories) <= 1 ) 478 return get_theme_root();478 return '/themes'; 479 479 480 480 $theme_roots = get_site_transient( 'theme_roots' ); … … 548 548 * @return bool 549 549 */ 550 function register_theme_directory( $directory 550 function register_theme_directory( $directory) { 551 551 global $wp_theme_directories; 552 552 553 if ( ! file_exists( $directory ) ) { 554 // Try prepending as the theme directory could be relative to the content directory 555 $directory = WP_CONTENT_DIR . '/' . $directory; 556 // If this directory does not exist, return and do not register 557 if ( ! file_exists( $directory ) ) 558 return false; 559 } 560 561 $wp_theme_directories[] = $directory; 553 /* If this folder does not exist, return and do not register */ 554 if ( !file_exists( $directory ) ) 555 /* Try prepending as the theme directory could be relative to the content directory */ 556 $registered_directory = WP_CONTENT_DIR . '/' . $directory; 557 else 558 $registered_directory = $directory; 559 560 /* If this folder does not exist, return and do not register */ 561 if ( !file_exists( $registered_directory ) ) 562 return false; 563 564 $wp_theme_directories[] = $registered_directory; 562 565 563 566 return true; … … 658 661 */ 659 662 function get_theme_root( $stylesheet_or_template = false ) { 660 if ( $stylesheet_or_template && $theme_root = get_raw_theme_root( $stylesheet_or_template ) ) 661 $theme_root = $theme_root; 662 else 663 if ( $stylesheet_or_template ) { 664 if ( $theme_root = get_raw_theme_root($stylesheet_or_template) ) 665 $theme_root = WP_CONTENT_DIR . $theme_root; 666 else 667 $theme_root = WP_CONTENT_DIR . '/themes'; 668 } else { 663 669 $theme_root = WP_CONTENT_DIR . '/themes'; 670 } 664 671 665 672 return apply_filters( 'theme_root', $theme_root ); … … 679 686 if ( $stylesheet_or_template ) { 680 687 if ( $theme_root = get_raw_theme_root($stylesheet_or_template) ) 681 $theme_root_uri = content_url( str_replace( WP_CONTENT_DIR, '', $theme_root ));688 $theme_root_uri = content_url( $theme_root ); 682 689 else 683 690 $theme_root_uri = content_url( 'themes' ); … … 690 697 691 698 /** 692 * Get the raw theme root with no filters applied.699 * Get the raw theme root relative to the content directory with no filters applied. 693 700 * 694 701 * @since 3.1.0 695 *696 * Before 3.4.0, this incorrectly returned a path relative to the content directory ("/themes") when697 * only one theme directory was registered. Absolute paths are now always returned.698 702 * 699 703 * @param string $stylesheet_or_template The stylesheet or template name of the theme … … 704 708 705 709 if ( count($wp_theme_directories) <= 1 ) 706 return WP_CONTENT_DIR .'/themes';710 return '/themes'; 707 711 708 712 $theme_root = false;
Note: See TracChangeset
for help on using the changeset viewer.