title: Multi select category WordPress customizer control
body: <p>I'm trying to create a multi select box category drop down, im having an issue with it.</p>
  
  <p>Here is the custom control class:</p>
  
  <pre><code>class Nt_Customize_Control_Multiple_Select extends WP_Customize_Control {
  
  /**
   * The type of customize control being rendered.
   */
  public $type = 'multiple-select';
  
  /**
   * Displays the multiple select on the customize screen.
   */
  public function render_content() {
  
  if ( empty( $this-&gt;choices ) )
      return;
  ?&gt;
      &lt;label&gt;
          &lt;span class="customize-control-title"&gt;&lt;?php echo esc_html( $this-&gt;label ); ?&gt;&lt;/span&gt;
          &lt;select &lt;?php $this-&gt;link(); ?&gt; multiple="multiple" style="height: 100%;"&gt;
              &lt;?php
                  foreach ( $this-&gt;choices as $value =&gt; $label ) {
                      $selected = ( in_array( $value, $this-&gt;value() ) ) ? selected( 1, 1, false ) : '';
                      echo '&lt;option value="' . esc_attr( $value ) . '"' . $selected . '&gt;' . $label . '&lt;/option&gt;';
                  }
              ?&gt;
          &lt;/select&gt;
      &lt;/label&gt;
  &lt;?php }}
  </code></pre>
  
  <p>Customizer option:</p>
  
  <pre><code>    $wp_customize-&gt;add_setting( 'nt_featured_cat', array(
      'default' =&gt; 0,
      'transport'   =&gt; 'refresh',
     'sanitize_callback' =&gt; 'nt_sanitize_cat' ));
  
  $wp_customize-&gt;add_control(
      new Nt_Customize_Control_Multiple_Select (
          $wp_customize,
          'nt_featured_cat',
          array(
              'settings' =&gt; 'nt_featured_cat',
              'label'    =&gt; 'Featured category',
              'section'  =&gt; 'nt_blog_archive_section', // Enter the name of your own section
              'type'     =&gt; 'multiple-select', // The $type in our class
              'choices' =&gt; nt_cats()
          )
      )
  );
  </code></pre>
  
  <p>and the categories function:</p>
  
  <pre><code> function nt_cats() {
    $cats = array();
    $cats[0] = "All";
    foreach ( get_categories() as $categories =&gt; $category ) {
      $cats[$category-&gt;term_id] = $category-&gt;name;
    }
    return $cats;
  }
  </code></pre>
  
  <p>any help will be appreciated, thanks!</p>