Menu_Dropdown_Custom_Control

Class to create a custom menu control.

Defined (1)

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

/lib/customizer/includes/menu-dropdown-custom-control.php  
  1. class Menu_Dropdown_Custom_Control extends WP_Customize_Control { 
  2. private $menus = false; 
  3.  
  4. public function __construct( $manager, $id, $args = array(), $options = array() ) { 
  5. $this->menus = wp_get_nav_menus( $options ); 
  6.  
  7. parent::__construct( $manager, $id, $args ); 
  8.  
  9. /** 
  10. * Render the content on the theme customizer page 
  11. */ 
  12. public function render_content() { 
  13. if ( ! empty( $this->menus ) ) { 
  14. ?> 
  15. <label> 
  16. <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> 
  17. <span class="description customize-control-description"><?php echo esc_attr( $this->description ); ?></span> 
  18. <select name="<?php echo $this->id; ?>" id="<?php echo $this->id; ?>"> 
  19. <?php 
  20. foreach ( $this->menus as $menu ) { 
  21. printf('<option value="%s" %s>%s</option>', $menu->term_id, selected($this->value(), $menu->term_id, false), $menu->name); 
  22. ?> 
  23. </select> 
  24. </label> 
  25. <?php