Changeset 32806 for trunk/src/wp-includes/class-wp-customize-manager.php
- Timestamp:
- 06/16/2015 10:07:08 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-customize-manager.php
r32744 r32806 50 50 public $widgets; 51 51 52 /** 53 * Methods and properties deailing with managing nav menus in the Customizer. 54 * 55 * @var WP_Customize_Nav_Menus 56 */ 57 public $nav_menus; 58 52 59 protected $settings = array(); 53 60 protected $containers = array(); … … 105 112 require_once( ABSPATH . WPINC . '/class-wp-customize-control.php' ); 106 113 require_once( ABSPATH . WPINC . '/class-wp-customize-widgets.php' ); 114 require_once( ABSPATH . WPINC . '/class-wp-customize-nav-menus.php' ); 107 115 108 116 $this->widgets = new WP_Customize_Widgets( $this ); 117 $this->nav_menus = new WP_Customize_Nav_Menus( $this ); 109 118 110 119 add_filter( 'wp_die_handler', array( $this, 'wp_die_handler' ) ); … … 1482 1491 foreach ( array( 'color', 'image', 'position_x', 'repeat', 'attachment' ) as $prop ) { 1483 1492 $this->get_setting( 'background_' . $prop )->transport = 'postMessage'; 1484 }1485 }1486 1487 /* Nav Menus */1488 1489 $locations = get_registered_nav_menus();1490 $menus = wp_get_nav_menus();1491 $num_locations = count( array_keys( $locations ) );1492 1493 if ( 1 == $num_locations ) {1494 $description = __( 'Your theme supports one menu. Select which menu you would like to use.' );1495 } else {1496 $description = sprintf( _n( 'Your theme supports %s menu. Select which menu appears in each location.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) );1497 }1498 1499 $this->add_section( 'nav', array(1500 'title' => __( 'Navigation' ),1501 'theme_supports' => 'menus',1502 'priority' => 100,1503 'description' => $description . "\n\n" . __( 'You can edit your menu content on the Menus screen in the Appearance section.' ),1504 ) );1505 1506 if ( $menus ) {1507 $choices = array( '' => __( '— Select —' ) );1508 foreach ( $menus as $menu ) {1509 $choices[ $menu->term_id ] = wp_html_excerpt( $menu->name, 40, '…' );1510 }1511 1512 foreach ( $locations as $location => $description ) {1513 $menu_setting_id = "nav_menu_locations[{$location}]";1514 1515 $this->add_setting( $menu_setting_id, array(1516 'sanitize_callback' => 'absint',1517 'theme_supports' => 'menus',1518 ) );1519 1520 $this->add_control( $menu_setting_id, array(1521 'label' => $description,1522 'section' => 'nav',1523 'type' => 'select',1524 'choices' => $choices,1525 ) );1526 1493 } 1527 1494 }
Note: See TracChangeset
for help on using the changeset viewer.