title: Hide the tab if there is no content
body: <p>I have below code with <code>Brochures</code> and <code>Resources</code> tabs. The code works perfectly fine, the only problem is when any of these tabs are empty the tab does not disappear. The empty tab-content link just remains there. I've explore and applied different scripts but each attempt resulted with fail. </p>
  
  <p>I hope you guys can help me on this.</p>
  
  <p>Sorry my code is little bit long. </p>
  
  <pre><code>&lt;div class="publication-slide-container"&gt;
      &lt;ul class="tab-links"&gt;
      &lt;li class="active"&gt;&lt;a href="#brochure"&gt;Brochures&lt;/a&gt;&lt;/li&gt;
      &lt;li&gt;&lt;a href="#article"&gt;Resources&lt;/a&gt;&lt;/li&gt;
      &lt;/ul&gt;
  
  &lt;div class="tab-content"&gt;
    &lt;div class="publication-slide full-slider active" ID="brochure"&gt;
      &lt;?php
  $terms = wp_get_post_terms($post-&gt;ID, array( 'publication-category', 'publication-type'), $args );
  
  foreach( $terms as $term ) {
    $args = array(
        'post_type'           =&gt; 'publication',
        'orderby'             =&gt; 'date',
        'order'               =&gt; 'ASC',
        'post_status'         =&gt; 'publish',
        'posts_per_page'      =&gt; - 1,
        'tax_query'           =&gt; array(
            'relation' =&gt; 'AND',
            array(
                'taxonomy'    =&gt; 'publication-category',
                'field'       =&gt; 'slug',
                'terms'       =&gt; array( $term-&gt;slug)
            ),
            array(
                'taxonomy'    =&gt; 'publication-type',
                'field'       =&gt; 'slug',
                'terms'       =&gt; array( 'brochure' )
            )
        )
    );
  
    $my_query = new WP_Query($args);
    if ($my_query-&gt;have_posts()) {
          while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); ?&gt;
  
             // something here
  
            &lt;?php
            endwhile;
    } 
    wp_reset_postdata();
  }
  ?&gt;
    &lt;/div&gt;
  
  &lt;div class="publication-slide full-slider" style="display:none;" ID="article"&gt;
  
      &lt;?php
  $terms = wp_get_post_terms($post-&gt;ID, array( 'publication-category', 'publication-type'), $args );
  
  foreach( $terms as $term ) {
    $args = array(
        'post_type'           =&gt; 'publication',
        'orderby'             =&gt; 'date',
        'order'               =&gt; 'DESC',
        'post_status'         =&gt; 'publish',
        'posts_per_page'      =&gt; 10,
        'tax_query'           =&gt; array(
            'relation' =&gt; 'AND',
            array(
                'taxonomy'    =&gt; 'publication-category',
                'field'       =&gt; 'slug',
                'terms'       =&gt; array( $term-&gt;slug)
            ),
            array(
                'taxonomy'    =&gt; 'publication-type',
                'field'       =&gt; 'slug',
                'terms'       =&gt; array( 'article', 'ASEAN Insiders', 'Expert Commentary' )
            )
        )
    );
  
    $my_query = new WP_Query($args);
    if ($my_query-&gt;have_posts()) {
          while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); ?&gt;
  
          //something here
  
    &lt;?php
            endwhile;
    } 
    wp_reset_postdata();
  }
  ?&gt;
    &lt;/div&gt;
  
  &lt;/div&gt;
  </code></pre>
  
  <p>and my script is</p>
  
  <pre><code>&lt;script&gt;
  jQuery(document).ready(function() {
      jQuery('.publication-slide-container .tab-links a').on('click', function(e) {
          var currentAttrValue = jQuery(this).attr('href');
  
  
             jQuery('.publication-slide-container ' + currentAttrValue).show().siblings().hide();
  
              jQuery(this).parent('li').addClass('active').siblings().removeClass('active');
  
          e.preventDefault();
      });
  });
  &lt;/script&gt;
  </code></pre>