Make WordPress Core

Changeset 33815


Ignore:
Timestamp:
08/30/2015 09:44:38 PM (9 years ago)
Author:
obenland
Message:

Themes: Get the correct theme when template and stylesheet were both passed as arguments.

Fixes a bug where $new_theme got set before the second argument was
appropriately handled, causing the current_theme option to later always be
updated to the parent theme's name.

Introduced in [21131].

Props obenland, wonderboymusic.
Fixes #32635.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/theme.php

    r33808 r33815  
    691691    $nav_menu_locations = get_theme_mod( 'nav_menu_locations' );
    692692
    693     $old_theme  = wp_get_theme();
     693    if ( func_num_args() > 1 ) {
     694        $stylesheet = func_get_arg( 1 );
     695    }
     696
     697    $old_theme = wp_get_theme();
    694698    $new_theme = wp_get_theme( $stylesheet );
    695 
    696     if ( func_num_args() > 1 ) {
    697         $template = $stylesheet;
    698         $stylesheet = func_get_arg( 1 );
    699     } else {
    700         $template = $new_theme->get_template();
    701     }
     699    $template  = $new_theme->get_template();
    702700
    703701    update_option( 'template', $template );
  • trunk/tests/phpunit/tests/theme.php

    r29952 r33815  
    8686        // Generic tests that should hold true for any theme
    8787        foreach ( $themes as $k => $theme ) {
     88            // Don't run these checks for custom themes.
     89            if ( empty( $theme['Author'] ) || false === strpos( $theme['Author'], 'WordPress' ) ) {
     90                continue;
     91            }
     92
    8893            $this->assertEquals( $theme['Name'], $k );
    8994            $this->assertNotEmpty( $theme['Title'] );
Note: See TracChangeset for help on using the changeset viewer.