WordPress.org

Make WordPress Core

Changeset 23871


Ignore:
Timestamp:
03/29/13 20:39:54 (13 months ago)
Author:
markjaquith
Message:

Add "Customize" as first item under Appearance menu.

fixes #21413. props ryanhellyer, obenland, DrewAPicture

Location:
trunk/wp-admin
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/css/wp-admin-rtl.css

    r23843 r23871  
    13391339} 
    13401340 
     1341.theme-options span { 
     1342    float: right; 
     1343    margin-right: 0; 
     1344    margin-left: 10px; 
     1345} 
     1346 
     1347.theme-options ul, 
    13411348.theme-options .load-customize { 
    1342     margin-right: 0; 
    1343     margin-left: 30px; 
    1344     float: right; 
    1345 } 
    1346  
    1347 .theme-options span { 
    1348     float: right; 
    1349     margin-right: 0; 
    1350     margin-left: 10px; 
    1351 } 
    1352  
    1353 .theme-options ul { 
    13541349    float: right; 
    13551350} 
  • trunk/wp-admin/css/wp-admin.css

    r23864 r23871  
    55485548} 
    55495549 
    5550 .theme-options .load-customize { 
    5551     margin-right: 30px; 
    5552     float: left; 
    5553 } 
    5554  
    55555550.theme-options span { 
    55565551    float: left; 
     
    55625557} 
    55635558 
    5564 .theme-options ul { 
     5559.theme-options ul, 
     5560.theme-options .load-customize { 
    55655561    float: left; 
    55665562    margin: 0; 
     
    64926488.no-customize-support .wp-core-ui .hide-if-no-customize, 
    64936489.customize-support.wp-core-ui .hide-if-customize, 
    6494 .customize-support .wp-core-ui .hide-if-customize { 
     6490.customize-support .wp-core-ui .hide-if-customize, 
     6491.no-customize-support .theme-options ul li:first-child { 
    64956492    display: none; 
    64966493} 
  • trunk/wp-admin/includes/menu.php

    r19712 r23871  
    7474    // If the first submenu is not the same as the assigned parent, 
    7575    // make the first submenu the new parent. 
    76     if ( $new_parent != $old_parent ) { 
     76    if ( $new_parent != $old_parent && 'customize.php' != $new_parent ) { 
    7777        $_wp_real_parent_file[$old_parent] = $new_parent; 
    7878        $menu[$id][2] = $new_parent; 
  • trunk/wp-admin/menu-header.php

    r23656 r23871  
    5454            $submenu_items = $submenu[$item[2]]; 
    5555        } 
    56  
     56         
    5757        if ( ( $parent_file && $item[2] == $parent_file ) || ( empty($typenow) && $self == $item[2] ) ) { 
    5858            $class[] = ! empty( $submenu_items ) ? 'wp-has-current-submenu wp-menu-open' : 'current'; 
     
    8383            echo '<div class="separator"></div>'; 
    8484        } elseif ( $submenu_as_parent && ! empty( $submenu_items ) ) { 
    85             $submenu_items = array_values( $submenu_items );  // Re-index. 
     85            $temp_submenu_items = $submenu_items = array_values( $submenu_items );  // Re-index. 
     86            if ( 'customize.php' == $submenu_items[0][2] ) 
     87                $submenu_items[0][2] = 'themes.php'; 
    8688            $menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] ); 
    8789            $menu_file = $submenu_items[0][2]; 
     
    9496                echo "\n\t<a href='{$submenu_items[0][2]}'$class $aria_attributes>$arrow<div class='wp-menu-image'>$img</div><div class='wp-menu-name'>$title</div></a>"; 
    9597            } 
     98            $submenu_items = $temp_submenu_items; 
    9699        } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) { 
    97100            $menu_hook = get_plugin_page_hook( $item[2], 'admin.php' ); 
     
    106109            } 
    107110        } 
    108  
     111         
    109112        if ( ! empty( $submenu_items ) ) { 
    110113            echo "\n\t<ul class='wp-submenu wp-submenu-wrap'>"; 
     
    141144                    $class[] = 'current'; 
    142145                } 
     146                 
     147                if ( ! empty( $sub_item[3] ) ) 
     148                    $class[] = $sub_item[3]; 
    143149 
    144150                $class = $class ? ' class="' . join( ' ', $class ) . '"' : ''; 
  • trunk/wp-admin/menu.php

    r22908 r23871  
    137137$menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' ); 
    138138 
    139 if ( current_user_can( 'switch_themes') ) { 
    140     $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'none' ); 
    141         $submenu['themes.php'][5]  = array(__('Themes'), 'switch_themes', 'themes.php'); 
    142         if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) 
    143             $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php'); 
    144 } else { 
    145     $menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'none' ); 
    146         $submenu['themes.php'][5]  = array(__('Themes'), 'edit_theme_options', 'themes.php'); 
    147         if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) 
    148             $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php' ); 
    149 } 
     139$appearance_cap = current_user_can( 'switch_themes') ? 'switch_themes' : 'edit_theme_options'; 
     140  
     141$menu[60] = array( __('Appearance'), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' ); 
     142    $submenu['themes.php'][4] = array( __( 'Customize' ), $appearance_cap, 'customize.php', 'hide-if-no-customize' );  
     143    $submenu['themes.php'][5] = array(__( 'Themes' ), $appearance_cap, 'themes.php'); 
     144    if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) 
     145        $submenu['themes.php'][10] = array(__( 'Menus' ), 'edit_theme_options', 'nav-menus.php'); 
     146 
     147unset( $appearance_cap ); 
    150148 
    151149// Add 'Editor' to the bottom of the Appearance menu. 
  • trunk/wp-admin/themes.php

    r21972 r23871  
    162162            if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] ) 
    163163                continue; 
     164            if ( 'customize.php' == $item[2] ) { 
     165                if ( current_user_can( 'edit_theme_options' ) ) 
     166                    $class = ' class="load-customize hide-if-no-customize"'; 
     167                else 
     168                    continue; 
     169            } 
    164170            // 0 = name, 1 = capability, 2 = file 
    165171            if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) ) 
     
    188194    ?> 
    189195    <div class="theme-options"> 
    190         <?php if ( current_user_can( 'edit_theme_options' ) ) : ?> 
    191         <a id="customize-current-theme-link" href="<?php echo wp_customize_url(); ?>" class="load-customize hide-if-no-customize" title="<?php echo esc_attr( $customize_title ); ?>"><?php _e( 'Customize' ); ?></a> 
    192         <?php 
    193         endif; // edit_theme_options 
    194         if ( $options ) : 
    195         ?> 
     196        <?php if ( $options ) : ?> 
    196197        <span><?php _e( 'Options:' )?></span> 
    197198        <ul> 
Note: See TracChangeset for help on using the changeset viewer.