function thb_get_structured_options_from_array($input, $value) { $opts = ""; foreach ($input as $optgroup => $options) { $opts .= "<optgroup label='{$optgroup}'>"; $opts .= thb_get_options_from_array($options); $opts .= "</optgroup>"; } return $opts; }
/** * Render the control. * * @return void */ public function render_content() { $this->options = array('scroll' => __('Scroll', 'thb_text_domain'), 'fixed' => __('Fixed', 'thb_text_domain')); ?> <label> <span class="customize-control-title"><?php echo esc_html($this->label); ?> </span> <select <?php $this->link(); ?> class="background-attachment"> <?php echo thb_get_options_from_array($this->options); ?> </select> </label> <?php }