User_Dropdown_Custom_Control

The Onetone User Dropdown Custom Control class.

Defined (1)

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

/lib/customizer/includes/user-dropdown-custom-control.php  
  1. class User_Dropdown_Custom_Control extends WP_Customize_Control { 
  2.  
  3. private $users = false; 
  4.  
  5. public function __construct( $manager, $id, $args = array(), $options = array() ) { 
  6. $this->users = get_users( $options ); 
  7.  
  8. parent::__construct( $manager, $id, $args ); 
  9.  
  10. /** 
  11. * Render the control's content. 
  12. * Allows the content to be overriden without having to rewrite the wrapper. 
  13. * @since 01/13/2013 
  14. * @return void 
  15. */ 
  16. public function render_content() { 
  17. if ( empty( $this->users ) ) { 
  18. return false; 
  19. ?> 
  20. <label> 
  21. <span class="customize-control-title" ><?php echo esc_html( $this->label ); ?></span> 
  22. <span class="description customize-control-description"><?php echo esc_attr( $this->description ); ?></span> 
  23. <select <?php $this->link(); ?>> 
  24. <?php foreach( $this->users as $user ) { 
  25. printf('<option value="%s" %s>%s</option>',  
  26. $user->data->ID,  
  27. selected($this->value(), $user->data->ID, false),  
  28. $user->data->display_name); 
  29. } ?> 
  30. </select> 
  31. </label> 
  32. <?php 
  33. } // end class