<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[23871] trunk/wp-admin: Add "Customize" as first item under Appearance menu.</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg > ul, #logmsg > ol { margin-left: 0; margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://core.trac.wordpress.org/changeset/23871">23871</a></dd>
<dt>Author</dt> <dd>markjaquith</dd>
<dt>Date</dt> <dd>2013-03-29 20:39:54 +0000 (Fri, 29 Mar 2013)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add "Customize" as first item under Appearance menu.
fixes <a href="http://core.trac.wordpress.org/ticket/21413">#21413</a>. props ryanhellyer, obenland, DrewAPicture</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkwpadmincsswpadminrtlcss">trunk/wp-admin/css/wp-admin-rtl.css</a></li>
<li><a href="#trunkwpadmincsswpadmincss">trunk/wp-admin/css/wp-admin.css</a></li>
<li><a href="#trunkwpadminincludesmenuphp">trunk/wp-admin/includes/menu.php</a></li>
<li><a href="#trunkwpadminmenuheaderphp">trunk/wp-admin/menu-header.php</a></li>
<li><a href="#trunkwpadminmenuphp">trunk/wp-admin/menu.php</a></li>
<li><a href="#trunkwpadminthemesphp">trunk/wp-admin/themes.php</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkwpadmincsswpadminrtlcss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin-rtl.css (23870 => 23871)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin-rtl.css        2013-03-29 20:35:23 UTC (rev 23870)
+++ trunk/wp-admin/css/wp-admin-rtl.css        2013-03-29 20:39:54 UTC (rev 23871)
</span><span class="lines">@@ -1338,19 +1338,14 @@
</span><span class="cx">         margin-right: -330px;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.theme-options .load-customize {
-        margin-right: 0;
-        margin-left: 30px;
-        float: right;
-}
-
</del><span class="cx"> .theme-options span {
</span><span class="cx">         float: right;
</span><span class="cx">         margin-right: 0;
</span><span class="cx">         margin-left: 10px;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.theme-options ul {
</del><ins>+.theme-options ul,
+.theme-options .load-customize {
</ins><span class="cx">         float: right;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadmincsswpadmincss"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/css/wp-admin.css (23870 => 23871)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/css/wp-admin.css        2013-03-29 20:35:23 UTC (rev 23870)
+++ trunk/wp-admin/css/wp-admin.css        2013-03-29 20:39:54 UTC (rev 23871)
</span><span class="lines">@@ -5547,11 +5547,6 @@
</span><span class="cx">         padding-bottom: 10px;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.theme-options .load-customize {
-        margin-right: 30px;
-        float: left;
-}
-
</del><span class="cx"> .theme-options span {
</span><span class="cx">         float: left;
</span><span class="cx">         margin-right: 10px;
</span><span class="lines">@@ -5561,7 +5556,8 @@
</span><span class="cx">         color: #999;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-.theme-options ul {
</del><ins>+.theme-options ul,
+.theme-options .load-customize {
</ins><span class="cx">         float: left;
</span><span class="cx">         margin: 0;
</span><span class="cx"> }
</span><span class="lines">@@ -6491,7 +6487,8 @@
</span><span class="cx"> .no-customize-support.wp-core-ui .hide-if-no-customize,
</span><span class="cx"> .no-customize-support .wp-core-ui .hide-if-no-customize,
</span><span class="cx"> .customize-support.wp-core-ui .hide-if-customize,
</span><del>-.customize-support .wp-core-ui .hide-if-customize {
</del><ins>+.customize-support .wp-core-ui .hide-if-customize,
+.no-customize-support .theme-options ul li:first-child {
</ins><span class="cx">         display: none;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminincludesmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/includes/menu.php (23870 => 23871)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/includes/menu.php        2013-03-29 20:35:23 UTC (rev 23870)
+++ trunk/wp-admin/includes/menu.php        2013-03-29 20:39:54 UTC (rev 23871)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx">         $new_parent = $first_sub[2];
</span><span class="cx">         // If the first submenu is not the same as the assigned parent,
</span><span class="cx">         // make the first submenu the new parent.
</span><del>-        if ( $new_parent != $old_parent ) {
</del><ins>+        if ( $new_parent != $old_parent && 'customize.php' != $new_parent ) {
</ins><span class="cx">                 $_wp_real_parent_file[$old_parent] = $new_parent;
</span><span class="cx">                 $menu[$id][2] = $new_parent;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminmenuheaderphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu-header.php (23870 => 23871)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu-header.php        2013-03-29 20:35:23 UTC (rev 23870)
+++ trunk/wp-admin/menu-header.php        2013-03-29 20:39:54 UTC (rev 23871)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx">                         $class[] = 'wp-has-submenu';
</span><span class="cx">                         $submenu_items = $submenu[$item[2]];
</span><span class="cx">                 }
</span><del>-
</del><ins>+                
</ins><span class="cx">                 if ( ( $parent_file && $item[2] == $parent_file ) || ( empty($typenow) && $self == $item[2] ) ) {
</span><span class="cx">                         $class[] = ! empty( $submenu_items ) ? 'wp-has-current-submenu wp-menu-open' : 'current';
</span><span class="cx">                 } else {
</span><span class="lines">@@ -82,7 +82,9 @@
</span><span class="cx">                 if ( false !== strpos( $class, 'wp-menu-separator' ) ) {
</span><span class="cx">                         echo '<div class="separator"></div>';
</span><span class="cx">                 } elseif ( $submenu_as_parent && ! empty( $submenu_items ) ) {
</span><del>-                        $submenu_items = array_values( $submenu_items ); // Re-index.
</del><ins>+                        $temp_submenu_items = $submenu_items = array_values( $submenu_items ); // Re-index.
+                        if ( 'customize.php' == $submenu_items[0][2] )
+                                $submenu_items[0][2] = 'themes.php';
</ins><span class="cx">                         $menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] );
</span><span class="cx">                         $menu_file = $submenu_items[0][2];
</span><span class="cx">                         if ( false !== ( $pos = strpos( $menu_file, '?' ) ) )
</span><span class="lines">@@ -93,6 +95,7 @@
</span><span class="cx">                         } else {
</span><span class="cx">                                 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>";
</span><span class="cx">                         }
</span><ins>+                        $submenu_items = $temp_submenu_items;
</ins><span class="cx">                 } elseif ( ! empty( $item[2] ) && current_user_can( $item[1] ) ) {
</span><span class="cx">                         $menu_hook = get_plugin_page_hook( $item[2], 'admin.php' );
</span><span class="cx">                         $menu_file = $item[2];
</span><span class="lines">@@ -105,7 +108,7 @@
</span><span class="cx">                                 echo "\n\t<a href='{$item[2]}'$class $aria_attributes>$arrow<div class='wp-menu-image'>$img</div><div class='wp-menu-name'>{$item[0]}</div></a>";
</span><span class="cx">                         }
</span><span class="cx">                 }
</span><del>-
</del><ins>+                
</ins><span class="cx">                 if ( ! empty( $submenu_items ) ) {
</span><span class="cx">                         echo "\n\t<ul class='wp-submenu wp-submenu-wrap'>";
</span><span class="cx">                         echo "<li class='wp-submenu-head'>{$item[0]}</li>";
</span><span class="lines">@@ -140,6 +143,9 @@
</span><span class="cx">                                 ) {
</span><span class="cx">                                         $class[] = 'current';
</span><span class="cx">                                 }
</span><ins>+                                
+                                if ( ! empty( $sub_item[3] ) )
+                                        $class[] = $sub_item[3];
</ins><span class="cx">
</span><span class="cx">                                 $class = $class ? ' class="' . join( ' ', $class ) . '"' : '';
</span><span class="cx">
</span></span></pre></div>
<a id="trunkwpadminmenuphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/menu.php (23870 => 23871)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/menu.php        2013-03-29 20:35:23 UTC (rev 23870)
+++ trunk/wp-admin/menu.php        2013-03-29 20:39:54 UTC (rev 23871)
</span><span class="lines">@@ -136,18 +136,16 @@
</span><span class="cx">
</span><span class="cx"> $menu[59] = array( '', 'read', 'separator2', '', 'wp-menu-separator' );
</span><span class="cx">
</span><del>-if ( current_user_can( 'switch_themes') ) {
-        $menu[60] = array( __('Appearance'), 'switch_themes', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'none' );
-                $submenu['themes.php'][5] = array(__('Themes'), 'switch_themes', 'themes.php');
-                if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
-                        $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php');
-} else {
-        $menu[60] = array( __('Appearance'), 'edit_theme_options', 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'none' );
-                $submenu['themes.php'][5] = array(__('Themes'), 'edit_theme_options', 'themes.php');
-                if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
-                        $submenu['themes.php'][10] = array(__('Menus'), 'edit_theme_options', 'nav-menus.php' );
-}
</del><ins>+$appearance_cap = current_user_can( 'switch_themes') ? 'switch_themes' : 'edit_theme_options';
+
+$menu[60] = array( __('Appearance'), $appearance_cap, 'themes.php', '', 'menu-top menu-icon-appearance', 'menu-appearance', 'div' );
+        $submenu['themes.php'][4] = array( __( 'Customize' ), $appearance_cap, 'customize.php', 'hide-if-no-customize' );
+        $submenu['themes.php'][5] = array(__( 'Themes' ), $appearance_cap, 'themes.php');
+        if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
+                $submenu['themes.php'][10] = array(__( 'Menus' ), 'edit_theme_options', 'nav-menus.php');
</ins><span class="cx">
</span><ins>+unset( $appearance_cap );
+
</ins><span class="cx"> // Add 'Editor' to the bottom of the Appearance menu.
</span><span class="cx"> if ( ! is_multisite() )
</span><span class="cx">         add_action('admin_menu', '_add_themes_utility_last', 101);
</span></span></pre></div>
<a id="trunkwpadminthemesphp"></a>
<div class="modfile"><h4>Modified: trunk/wp-admin/themes.php (23870 => 23871)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/wp-admin/themes.php        2013-03-29 20:35:23 UTC (rev 23870)
+++ trunk/wp-admin/themes.php        2013-03-29 20:39:54 UTC (rev 23871)
</span><span class="lines">@@ -161,6 +161,12 @@
</span><span class="cx">                         $class = '';
</span><span class="cx">                         if ( 'themes.php' == $item[2] || 'theme-editor.php' == $item[2] )
</span><span class="cx">                                 continue;
</span><ins>+                        if ( 'customize.php' == $item[2] ) {
+                                if ( current_user_can( 'edit_theme_options' ) )
+                                        $class = ' class="load-customize hide-if-no-customize"';
+                                else
+                                        continue;
+                        }
</ins><span class="cx">                         // 0 = name, 1 = capability, 2 = file
</span><span class="cx">                         if ( ( strcmp($self, $item[2]) == 0 && empty($parent_file)) || ($parent_file && ($item[2] == $parent_file)) )
</span><span class="cx">                                 $class = ' class="current"';
</span><span class="lines">@@ -187,12 +193,7 @@
</span><span class="cx">         if ( $options || current_user_can( 'edit_theme_options' ) ) :
</span><span class="cx">         ?>
</span><span class="cx">         <div class="theme-options">
</span><del>-                <?php if ( current_user_can( 'edit_theme_options' ) ) : ?>
-                <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>
-                <?php
-                endif; // edit_theme_options
-                if ( $options ) :
-                ?>
</del><ins>+                <?php if ( $options ) : ?>
</ins><span class="cx">                 <span><?php _e( 'Options:' )?></span>
</span><span class="cx">                 <ul>
</span><span class="cx">                         <?php foreach ( $options as $option ) : ?>
</span></span></pre>
</div>
</div>
</body>
</html>