For the current theme, display all available actions, as dictated by the admin menu.

Restores 3.7 behavior. This could include things like Header and Background as well as theme options pages.

see #25948.

Built from https://develop.svn.wordpress.org/trunk@26531


git-svn-id: http://core.svn.wordpress.org/trunk@26424 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Andrew Nacin 2013-12-02 18:58:09 +00:00
parent e31c68f9d2
commit bb32d28c75
1 changed files with 15 additions and 20 deletions

View File

@ -145,10 +145,10 @@ if ( $ct->errors() && ( ! is_multisite() || current_user_can( 'manage_network_th
// Certain error codes are less fatal than others. We can still display theme information in most cases. // Certain error codes are less fatal than others. We can still display theme information in most cases.
if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() ) if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() )
&& in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?> && in_array( $ct->errors()->get_error_code(), array( 'theme_no_parent', 'theme_parent_invalid', 'theme_no_index' ) ) ) ) : ?>
*/
<?php
// Pretend you didn't see this. // Pretend you didn't see this.
$options = array(); $current_theme_actions = array();
if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) { if ( is_array( $submenu ) && isset( $submenu['themes.php'] ) ) {
foreach ( (array) $submenu['themes.php'] as $item) { foreach ( (array) $submenu['themes.php'] as $item) {
$class = ''; $class = '';
@ -161,22 +161,22 @@ if ( ! $ct->errors() || ( 1 == count( $ct->errors()->get_error_codes() )
$submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index. $submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]); $menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook)) if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
$options[] = "<a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>"; $current_theme_actions[] = "<a class='button button-secondary' href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
else else
$options[] = "<a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>"; $current_theme_actions[] = "<a class='button button-secondary' href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
} else if ( current_user_can($item[1]) ) { } else if ( current_user_can($item[1]) ) {
$menu_file = $item[2]; $menu_file = $item[2];
if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) if ( false !== ( $pos = strpos( $menu_file, '?' ) ) )
$menu_file = substr( $menu_file, 0, $pos ); $menu_file = substr( $menu_file, 0, $pos );
if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) { if ( file_exists( ABSPATH . "wp-admin/$menu_file" ) ) {
$options[] = "<a href='{$item[2]}'$class>{$item[0]}</a>"; $current_theme_actions[] = "<a class='button button-secondary' href='{$item[2]}'$class>{$item[0]}</a>";
} else { } else {
$options[] = "<a href='themes.php?page={$item[2]}'$class>{$item[0]}</a>"; $current_theme_actions[] = "<a class='button button-secondary' href='themes.php?page={$item[2]}'$class>{$item[0]}</a>";
} }
} }
} }
} }
*/
?> ?>
<div class="theme-browser"></div> <div class="theme-browser"></div>
@ -295,12 +295,7 @@ if ( ! is_multisite() && current_user_can('edit_themes') && $broken_themes = wp_
<div class="theme-actions"> <div class="theme-actions">
<div class="active-theme"> <div class="active-theme">
<a href="{{{ data.actions.customize }}}" class="button button-primary hide-if-no-customize"><?php _e( 'Customize' ); ?></a> <a href="{{{ data.actions.customize }}}" class="button button-primary hide-if-no-customize"><?php _e( 'Customize' ); ?></a>
<?php if ( current_theme_supports( 'menus' ) ) { ?> <?php echo implode( ' ', $current_theme_actions ); ?>
<a class="button button-secondary" href="<?php echo admin_url( 'nav-menus.php' ); ?>"><?php _e( 'Menus' ); ?></a>
<?php } ?>
<?php if ( current_theme_supports( 'widgets' ) ) { ?>
<a class="button button-secondary" href="<?php echo admin_url( 'widgets.php' ); ?>"><?php _e( 'Widgets' ); ?></a>
<?php } ?>
</div> </div>
<div class="inactive-theme"> <div class="inactive-theme">
<# if ( data.actions.activate ) { #> <# if ( data.actions.activate ) { #>