Make WordPress Core

Changeset 47770


Ignore:
Timestamp:
05/06/2020 07:33:45 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Menus: Add a Cancel link to the screen for creating a new menu.

The use case this helps the most is when there's only one menu and you click "create a new menu". In this case the Cancel link allows you to go back to the single existing menu.

Props garrett-eclipse, audrasjb.
Fixes #46367.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/nav-menus.php

    r47605 r47770  
    888888                        <form id="update-nav-menu" method="post" enctype="multipart/form-data">
    889889                        <?php
    890                                 $new_screen_class = '';
     890                        $new_screen_class = '';
    891891                        if ( $add_new_screen ) {
    892892                                $new_screen_class = 'blank-slate';
     
    926926                                                <div id="post-body-content" class="wp-clearfix">
    927927                                                        <?php if ( ! $add_new_screen ) : ?>
     928
    928929                                                                <?php
    929930                                                                $hide_style = '';
     
    938939                                                                }
    939940                                                                ?>
    940                                                         <div class="drag-instructions post-body-plain" <?php echo $hide_style; ?>>
    941                                                                 <p><?php echo $starter_copy; ?></p>
    942                                                         </div>
     941                                                                <div class="drag-instructions post-body-plain" <?php echo $hide_style; ?>>
     942                                                                        <p><?php echo $starter_copy; ?></p>
     943                                                                </div>
     944
    943945                                                                <?php
    944946                                                                if ( isset( $edit_markup ) && ! is_wp_error( $edit_markup ) ) {
     
    946948                                                                } else {
    947949                                                                        ?>
    948                                                         <ul class="menu" id="menu-to-edit"></ul>
     950                                                                        <ul class="menu" id="menu-to-edit"></ul>
    949951                                                                <?php } ?>
     952
    950953                                                        <?php endif; ?>
     954
    951955                                                        <?php if ( $add_new_screen ) : ?>
    952956                                                                <p class="post-body-plain" id="menu-name-desc"><?php _e( 'Give your menu a name, then click Create Menu.' ); ?></p>
     
    954958                                                                        <input type="hidden" name="use-location" value="<?php echo esc_attr( $_GET['use-location'] ); ?>" />
    955959                                                                <?php endif; ?>
     960
    956961                                                                <?php
    957                                                                 endif;
    958 
    959                                                                 $no_menus_style = '';
     962                                                        endif;
     963
     964                                                        $no_menus_style = '';
    960965                                                        if ( $one_theme_location_no_menus ) {
    961966                                                                $no_menus_style = 'style="display: none;"';
     
    10151020                                        <div id="nav-menu-footer">
    10161021                                                <div class="major-publishing-actions wp-clearfix">
    1017                                                         <?php if ( 0 != $menu_count && ! $add_new_screen ) : ?>
    1018                                                         <span class="delete-action">
    1019                                                                 <a class="submitdelete deletion menu-delete" href="
    1020                                                                 <?php
    1021                                                                 echo esc_url(
    1022                                                                         wp_nonce_url(
    1023                                                                                 add_query_arg(
    1024                                                                                         array(
    1025                                                                                                 'action' => 'delete',
    1026                                                                                                 'menu'   => $nav_menu_selected_id,
     1022                                                        <?php if ( $menu_count > 0 ) : ?>
     1023
     1024                                                                <?php if ( $add_new_screen ) : ?>
     1025                                                                <span class="cancel-action">
     1026                                                                        <a class="submitcancel cancellation menu-cancel" href="<?php echo esc_url( admin_url( 'nav-menus.php' ) ); ?>"><?php _e( 'Cancel' ); ?></a>
     1027                                                                </span><!-- END .cancel-action -->
     1028                                                                <?php else : ?>
     1029                                                                <span class="delete-action">
     1030                                                                        <a class="submitdelete deletion menu-delete" href="
     1031                                                                        <?php
     1032                                                                        echo esc_url(
     1033                                                                                wp_nonce_url(
     1034                                                                                        add_query_arg(
     1035                                                                                                array(
     1036                                                                                                        'action' => 'delete',
     1037                                                                                                        'menu' => $nav_menu_selected_id,
     1038                                                                                                ),
     1039                                                                                                admin_url( 'nav-menus.php' )
    10271040                                                                                        ),
    1028                                                                                         admin_url( 'nav-menus.php' )
    1029                                                                                 ),
    1030                                                                                 'delete-nav_menu-' . $nav_menu_selected_id
    1031                                                                         )
    1032                                                                 );
    1033                                                                 ?>
    1034                                                                 "><?php _e( 'Delete Menu' ); ?></a>
    1035                                                         </span><!-- END .delete-action -->
     1041                                                                                        'delete-nav_menu-' . $nav_menu_selected_id
     1042                                                                                )
     1043                                                                        );
     1044                                                                        ?>
     1045                                                                        "><?php _e( 'Delete Menu' ); ?></a>
     1046                                                                </span><!-- END .delete-action -->
     1047                                                                <?php endif; ?>
     1048
    10361049                                                        <?php endif; ?>
    10371050                                                        <div class="publishing-action">
Note: See TracChangeset for help on using the changeset viewer.