Changeset 33488 for trunk/src/wp-includes/default-widgets.php
- Timestamp:
- 07/29/2015 04:02:08 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/default-widgets.php
r32907 r33488 1571 1571 1572 1572 // If no menus exists, direct the user to go and create some. 1573 if ( !$menus ) {1574 echo '<p>'. sprintf( __('No menus have been created yet. <a href="%s">Create some</a>.'), admin_url('nav-menus.php') ) .'</p>';1575 return;1576 }1577 1573 ?> 1578 <p> 1579 <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:') ?></label> 1580 <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" /> 1574 <p class="nav-menu-widget-no-menus-message" <?php if ( ! empty( $menus ) ) { echo ' style="display:none" '; } ?>> 1575 <?php 1576 if ( isset( $GLOBALS['wp_customize'] ) && $GLOBALS['wp_customize'] instanceof WP_Customize_Manager ) { 1577 // @todo When expanding a panel, the JS should be smart enough to collapse any existing panels and sections. 1578 $url = 'javascript: wp.customize.section.each(function( section ){ section.collapse(); }); wp.customize.panel( "nav_menus" ).focus();'; 1579 } else { 1580 $url = admin_url( 'nav-menus.php' ); 1581 } 1582 ?> 1583 <?php echo sprintf( __( 'No menus have been created yet. <a href="%s">Create some</a>.' ), esc_attr( $url ) ); ?> 1581 1584 </p> 1582 <p> 1583 <label for="<?php echo $this->get_field_id('nav_menu'); ?>"><?php _e('Select Menu:'); ?></label> 1584 <select id="<?php echo $this->get_field_id('nav_menu'); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>"> 1585 <option value="0"><?php _e( '— Select —' ) ?></option> 1586 <?php 1587 foreach ( $menus as $menu ) { 1588 echo '<option value="' . $menu->term_id . '"' 1589 . selected( $nav_menu, $menu->term_id, false ) 1590 . '>'. esc_html( $menu->name ) . '</option>'; 1591 } 1592 ?> 1593 </select> 1594 </p> 1585 <div class="nav-menu-widget-form-controls" <?php if ( empty( $menus ) ) { echo ' style="display:none" '; } ?>> 1586 <p> 1587 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:' ) ?></label> 1588 <input type="text" class="widefat" id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo esc_attr( $title ); ?>"/> 1589 </p> 1590 <p> 1591 <label for="<?php echo $this->get_field_id( 'nav_menu' ); ?>"><?php _e( 'Select Menu:' ); ?></label> 1592 <select id="<?php echo $this->get_field_id( 'nav_menu' ); ?>" name="<?php echo $this->get_field_name( 'nav_menu' ); ?>"> 1593 <option value="0"><?php _e( '— Select —' ); ?></option> 1594 <?php foreach ( $menus as $menu ) : ?> 1595 <option value="<?php echo esc_attr( $menu->term_id ); ?>" <?php selected( $nav_menu, $menu->term_id ); ?>> 1596 <?php echo esc_html( $menu->name ); ?> 1597 </option> 1598 <?php endforeach; ?> 1599 </select> 1600 </p> 1601 </div> 1595 1602 <?php 1596 1603 }
Note: See TracChangeset
for help on using the changeset viewer.