Make WordPress Core


Ignore:
Timestamp:
02/24/2015 08:30:22 PM (10 years ago)
Author:
markjaquith
Message:

Add theme browsing and theme switching to the Customizer

  • Brings into core the Customizer Theme Switcher feature plugin
  • You can now browse, preview, and activate themes right from the Customizer

fixes #31303.
props celloexpressions, afercia, westonruter, folletto, designsimply

File:
1 edited

Legend:

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

    r31456 r31533  
    651651    $wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance' ) );
    652652
    653     if ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) )
    654         $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'themes', 'title' => __('Themes'), 'href' => admin_url('themes.php') ) );
    655 
    656     if ( ! current_user_can( 'edit_theme_options' ) )
    657         return;
    658 
    659653    $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
    660654    $customize_url = add_query_arg( 'url', urlencode( $current_url ), wp_customize_url() );
     655
     656    if ( current_user_can( 'switch_themes' ) ) {
     657        $wp_admin_bar->add_menu( array(
     658            'parent' => 'appearance',
     659            'id'     => 'themes',
     660            'title'  => __( 'Themes' ),
     661            'href'   => admin_url( 'themes.php' ),
     662            'meta'   => array(
     663                'class' => 'hide-if-customize',
     664            ),
     665        ) );
     666
     667        if ( current_user_can( 'customize' ) ) {
     668            $wp_admin_bar->add_menu( array(
     669                'parent' => 'appearance',
     670                'id'     => 'customize-themes',
     671                'title'  => __( 'Themes' ),
     672                'href'   => add_query_arg( urlencode( 'autofocus[section]' ), 'themes', $customize_url ), // urlencode() needed due to #16859
     673                'meta'   => array(
     674                    'class' => 'hide-if-no-customize',
     675                ),
     676            ) );
     677        }
     678    }
     679
    661680    if ( current_user_can( 'customize' ) ) {
    662681        $wp_admin_bar->add_menu( array(
     
    670689        ) );
    671690        add_action( 'wp_before_admin_bar_render', 'wp_customize_support_script' );
     691    }
     692
     693    if ( ! current_user_can( 'edit_theme_options' ) ) {
     694        return;
    672695    }
    673696
Note: See TracChangeset for help on using the changeset viewer.