Menus: Respect context when linking to the Customizer.

`Manage in Customizer` will now link to menu locations or the menus panel in
the customizer, depending on whether the user is editing menus or managing
locations.

Props rabmalin for initial patch.
Fixes #32852.



git-svn-id: https://develop.svn.wordpress.org/trunk@33112 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Konstantin Obenland 2015-07-07 17:48:23 +00:00
parent a399fb0b38
commit 36a9b5b0d4
1 changed files with 9 additions and 10 deletions

View File

@ -562,21 +562,20 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'locations' != $_GET['action'] ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Edit Menus' ); ?></a>
<?php if ( $num_locations && $menu_count ) : ?>
<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( $locations_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Manage Locations' ); ?></a>
<?php endif; ?>
<?php
if ( current_user_can( 'customize' ) ) {
endif;
if ( current_user_can( 'customize' ) ) :
$focus = $locations_screen ? array( 'section' => 'menu_locations' ) : array( 'panel' => 'nav_menus' );
printf(
' <a class="page-title-action hide-if-no-customize" href="%1$s">%2$s</a>',
esc_url( add_query_arg(
array(
array( 'autofocus' => array( 'panel' => 'nav_menus' ) ),
'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) )
),
admin_url( 'customize.php' )
) ),
esc_url( add_query_arg( array(
array( 'autofocus' => $focus ),
'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
), admin_url( 'customize.php' ) ) ),
__( 'Manage in Customizer' )
);
}
endif;
?>
</h1>
<?php