WP_Customize_Nav_Menu_Location_Control

Customize Menu Location Control Class.

Defined (1)

The class is defined in the following location(s).

/wp-includes/customize/class-wp-customize-nav-menu-location-control.php  
  1. class WP_Customize_Nav_Menu_Location_Control extends WP_Customize_Control { 
  2.  
  3. /** 
  4. * Control type. 
  5. * @since 4.3.0 
  6. * @access public 
  7. * @var string 
  8. */ 
  9. public $type = 'nav_menu_location'; 
  10.  
  11. /** 
  12. * Location ID. 
  13. * @since 4.3.0 
  14. * @access public 
  15. * @var string 
  16. */ 
  17. public $location_id = ''; 
  18.  
  19. /** 
  20. * Refresh the parameters passed to JavaScript via JSON. 
  21. * @since 4.3.0 
  22. * @access public 
  23. * @see WP_Customize_Control::to_json() 
  24. */ 
  25. public function to_json() { 
  26. parent::to_json(); 
  27. $this->json['locationId'] = $this->location_id; 
  28.  
  29. /** 
  30. * Render content just like a normal select control. 
  31. * @since 4.3.0 
  32. * @access public 
  33. */ 
  34. public function render_content() { 
  35. if ( empty( $this->choices ) ) { 
  36. return; 
  37. ?> 
  38. <label> 
  39. <?php if ( ! empty( $this->label ) ) : ?> 
  40. <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> 
  41. <?php endif; ?> 
  42.  
  43. <?php if ( ! empty( $this->description ) ) : ?> 
  44. <span class="description customize-control-description"><?php echo $this->description; ?></span> 
  45. <?php endif; ?> 
  46.  
  47. <select <?php $this->link(); ?>> 
  48. <?php 
  49. foreach ( $this->choices as $value => $label ) : 
  50. echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>'; 
  51. endforeach; 
  52. ?> 
  53. </select> 
  54. </label> 
  55. <button type="button" class="button-link edit-menu<?php if ( ! $this->value() ) { echo ' hidden'; } ?>" aria-label="<?php esc_attr_e( 'Edit selected menu' ); ?>"><?php _e( 'Edit Menu' ); ?></button> 
  56. <?php