WordPress.org

Make WordPress Core

Ticket #23770: 23770.diff

File 23770.diff, 3.3 KB (added by lessbloat, 2 years ago)
  • wp-admin/nav-menus.php

     
    340340                        } 
    341341                } 
    342342                break; 
     343        case 'locations': 
     344 
     345                break; 
    343346} 
    344347 
    345348// Get all nav menus 
     
    349352// Are we on the add new screen? 
    350353$add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : false; 
    351354 
     355$locations_screen = ( isset( $_GET['action'] ) && 'locations' == $_GET['action'] ) ? true : false; 
     356 
    352357// If we have one theme location, and zero menus, we take them right into editing their first menu 
    353358$page_count = wp_count_posts( 'page' ); 
    354359$one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) ? true : false; 
     
    453458?> 
    454459<div class="wrap"> 
    455460        <?php screen_icon(); ?> 
    456         <h2><?php _e( 'Menus' ); ?> <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0, ), admin_url( 'nav-menus.php' ) ) ); ?>" class="add-new-h2"><?php _ex( 'Add New', 'menu' ); ?></a></h2> 
     461        <h2 class="nav-tab-wrapper"> 
     462                <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> 
     463                <a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( isset( $_GET['action'] ) && 'locations' == $_GET['action'] ) echo ' nav-tab-active'; ?>"><?php esc_html_e('Manage Locations'); ?></a> 
     464        </h2> 
    457465        <?php 
    458466        foreach( $messages as $message ) : 
    459467                echo $message . "\n"; 
    460468        endforeach; 
    461469        ?> 
     470        <?php if ( $locations_screen ) : ?> 
     471        Yay manage locations. 
     472        <?php else : ?> 
    462473        <div class="manage-menus"> 
    463         <?php if ( $menu_count < 2 ) : ?> 
     474                <?php if ( $menu_count < 2 ) : ?> 
    464475                <span class="add-edit-menu-action"> 
    465476                        <?php printf( __( 'Edit your menu below, or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?> 
    466477                </span><!-- /add-edit-menu-action --> 
    467         <?php else : ?> 
     478                <?php else : ?> 
    468479                <form method="post" action="<?php echo admin_url( 'nav-menus.php' ); ?>"> 
    469480                        <input type="hidden" name="action" value="edit" /> 
    470481                        <label for="menu" class="selected-menu"><?php _e( 'Select a menu to edit:' ); ?></label> 
     
    499510                                <?php printf( __( 'or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?> 
    500511                        </span><!-- /add-new-menu-action --> 
    501512                </form> 
    502         <?php endif; ?> 
     513                <?php endif; ?> 
    503514        </div><!-- /manage-menus --> 
    504515        <div id="nav-menus-frame"> 
    505516        <div id="menu-settings-column" class="metabox-holder<?php if ( isset( $_GET['menu'] ) && '0' == $_GET['menu'] ) { echo ' metabox-holder-disabled'; } ?>"> 
     
    610621                </div><!-- /#menu-management --> 
    611622        </div><!-- /#menu-management-liquid --> 
    612623        </div><!-- /#nav-menus-frame --> 
     624        <?php endif; ?> 
    613625</div><!-- /.wrap--> 
    614626<script type="text/javascript">var oneThemeLocationNoMenus = <?php if ( $one_theme_location_no_menus ) echo 'true'; else echo 'false'; ?>;</script> 
    615627<?php include( './admin-footer.php' ); ?>