Changeset 21131 for trunk/wp-includes/theme.php
- Timestamp:
- 06/26/2012 05:21:04 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/theme.php
r21126 r21131 651 651 652 652 /** 653 * Switches current theme to new template and stylesheet names. 653 * Switches the theme. 654 * 655 * Accepts one argument: $stylesheet of the theme. It also accepts an additional function signature 656 * of two arguments: $template then $stylesheet. This is for backwards compatibility. 654 657 * 655 658 * @since 2.5.0 656 659 * @uses do_action() Calls 'switch_theme' action, passing the new theme. 657 660 * 658 * @param string $template Template name 659 * @param string $stylesheet Stylesheet name. 660 */ 661 function switch_theme( $template, $stylesheet ) { 661 * @param string $stylesheet Stylesheet name 662 */ 663 function switch_theme( $stylesheet ) { 662 664 global $wp_theme_directories, $sidebars_widgets; 663 665 … … 667 669 $old_theme = wp_get_theme(); 668 670 $new_theme = wp_get_theme( $stylesheet ); 669 $new_name = $new_theme->get('Name'); 671 672 if ( func_num_args() > 1 ) { 673 $template = $stylesheet; 674 $stylesheet = func_get_arg( 1 ); 675 } else { 676 $template = $new_theme->get_template(); 677 } 670 678 671 679 update_option( 'template', $template ); … … 676 684 update_option( 'stylesheet_root', get_raw_theme_root( $stylesheet, true ) ); 677 685 } 686 687 $new_name = $new_theme->get('Name'); 678 688 679 689 update_option( 'current_theme', $new_name ); … … 707 717 708 718 if ( get_template() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/index.php') ) { 709 switch_theme( WP_DEFAULT_THEME , WP_DEFAULT_THEME);719 switch_theme( WP_DEFAULT_THEME ); 710 720 return false; 711 721 } 712 722 713 723 if ( get_stylesheet() != WP_DEFAULT_THEME && !file_exists(get_template_directory() . '/style.css') ) { 714 switch_theme( WP_DEFAULT_THEME , WP_DEFAULT_THEME);724 switch_theme( WP_DEFAULT_THEME ); 715 725 return false; 716 726 } 717 727 718 728 if ( is_child_theme() && ! file_exists( get_stylesheet_directory() . '/style.css' ) ) { 719 switch_theme( WP_DEFAULT_THEME , WP_DEFAULT_THEME);729 switch_theme( WP_DEFAULT_THEME ); 720 730 return false; 721 731 }
Note: See TracChangeset
for help on using the changeset viewer.