Skip to main content
deleted 43 characters in body
Source Link
<?php 
        echo '<ul class="tabs" data-tabs id="example-tabs">';
        echo '<li class="tabs-title is-active link-no-style">';
        echo '<a href="#" aria-selected="true">All</a>';
        echo '</li>';   

        $_terms = get_terms(array('filed-under'));
        foreach ($_terms as $term) {
        $term_slug = $term->slug;

        // TABBED HEADERS 
        echo '<li class="tabs-title link-no-style">';
        echo '<a href="#' . $term->slug . '"aria-selected="true" role="tab" data-toggle="tab">';
        echo $term->name;
        echo '</a>';
        echo '</li>';
        }  // CLOSE OFF FIRST LOOP 
        echo '</ul>';
 
        
        foreach ($_terms as $term) :
        $term_slug = $term->slug;
        
        // QUERY
        $_posts = new WP_Query( array(
          'post_type'         => 'testimonial',
          'posts_per_page'    => -1, 
          'tax_query' => array(
            array(
              'taxonomy' => 'filed-under',
              'field'    => 'slug',
              'terms'    => $term_slug,
            ),
          ),
        )); 
        
        // TABBED CONTENT
        echo '<div class="tabs-content" data-tabs-content="example-tabs">';
        echo '<div class="tabs-panel" id="' . $term_slug . '">';
        echo '<ul class="accordion" data-accordion data-allow-all-closed="true">';
        if( $_posts->have_posts() ) :  while ( $_posts->have_posts() ) : $_posts->the_post(); 
        echo '<li class="accordion-item" data-accordion-item>';
        echo '<a href="#" class="accordion-title">';
        echo '<p>';
        the_title(); 
        echo '</p>';
        echo '</a>';
        echo '<div class="accordion-content" data-tab-content>';
        echo the_field('testimonial');
        echo '</div>';
        echo '</li>'; 
        endwhile; endif; wp_reset_postdata();
        echo '</ul>';
        echo '</div>';
        echo '</div>';
        endforeach; 
        ?>
<?php 
        echo '<ul class="tabs" data-tabs id="example-tabs">';
        echo '<li class="tabs-title is-active link-no-style">';
        echo '<a href="#" aria-selected="true">All</a>';
        echo '</li>';  
        $_terms = get_terms(array('filed-under'));
        foreach ($_terms as $term) {
        $term_slug = $term->slug;

        // TABBED HEADERS 
        echo '<li class="tabs-title link-no-style">';
        echo '<a href="#' . $term->slug . '"aria-selected="true" role="tab" data-toggle="tab">';
        echo $term->name;
        echo '</a>';
        echo '</li>';
        }  // CLOSE OFF FIRST LOOP 
        echo '</ul>';
 
        
        foreach ($_terms as $term) :
        $term_slug = $term->slug;
        
        // QUERY
        $_posts = new WP_Query( array(
          'post_type'         => 'testimonial',
          'posts_per_page'    => -1, 
          'tax_query' => array(
            array(
              'taxonomy' => 'filed-under',
              'field'    => 'slug',
              'terms'    => $term_slug,
            ),
          ),
        )); 
        
        // TABBED CONTENT
        echo '<div class="tabs-content" data-tabs-content="example-tabs">';
        echo '<div class="tabs-panel" id="' . $term_slug . '">';
        echo '<ul class="accordion" data-accordion data-allow-all-closed="true">';
        if( $_posts->have_posts() ) :  while ( $_posts->have_posts() ) : $_posts->the_post(); 
        echo '<li class="accordion-item" data-accordion-item>';
        echo '<a href="#" class="accordion-title">';
        echo '<p>';
        the_title(); 
        echo '</p>';
        echo '</a>';
        echo '<div class="accordion-content" data-tab-content>';
        echo the_field('testimonial');
        echo '</div>';
        echo '</li>'; 
        endwhile; endif; wp_reset_postdata();
        echo '</ul>';
        echo '</div>';
        echo '</div>';
        endforeach; 
        ?>
<?php 
        echo '<ul class="tabs" data-tabs id="example-tabs">';
        echo '<li class="tabs-title is-active link-no-style">';
        echo '<a href="#" aria-selected="true">All</a>';
        echo '</li>';   

        $_terms = get_terms(array('filed-under'));
        foreach ($_terms as $term) {

        // TABBED HEADERS 
        echo '<li class="tabs-title link-no-style">';
        echo '<a href="#' . $term->slug . '"aria-selected="true" role="tab" data-toggle="tab">';
        echo $term->name;
        echo '</a>';
        echo '</li>';
        }  // CLOSE OFF FIRST LOOP 
        echo '</ul>';

        foreach ($_terms as $term) :
        $term_slug = $term->slug;
        
        // QUERY
        $_posts = new WP_Query( array(
          'post_type'         => 'testimonial',
          'posts_per_page'    => -1, 
          'tax_query' => array(
            array(
              'taxonomy' => 'filed-under',
              'field'    => 'slug',
              'terms'    => $term_slug,
            ),
          ),
        )); 
        
        // TABBED CONTENT
        echo '<div class="tabs-content" data-tabs-content="example-tabs">';
        echo '<div class="tabs-panel" id="' . $term_slug . '">';
        echo '<ul class="accordion" data-accordion data-allow-all-closed="true">';
        if( $_posts->have_posts() ) :  while ( $_posts->have_posts() ) : $_posts->the_post(); 
        echo '<li class="accordion-item" data-accordion-item>';
        echo '<a href="#" class="accordion-title">';
        echo '<p>';
        the_title(); 
        echo '</p>';
        echo '</a>';
        echo '<div class="accordion-content" data-tab-content>';
        echo the_field('testimonial');
        echo '</div>';
        echo '</li>'; 
        endwhile; endif; wp_reset_postdata();
        echo '</ul>';
        echo '</div>';
        echo '</div>';
        endforeach; 
        ?>
added 2063 characters in body
Source Link

CODE V2

<?php 
        echo '<ul class="tabs" data-tabs id="example-tabs">';
        echo '<li class="tabs-title is-active link-no-style">';
        echo '<a href="#" aria-selected="true">All</a>';
        echo '</li>';  
        $_terms = get_terms(array('filed-under'));
        foreach ($_terms as $term) {
        $term_slug = $term->slug;

        // TABBED HEADERS 
        echo '<li class="tabs-title link-no-style">';
        echo '<a href="#' . $term->slug . '"aria-selected="true" role="tab" data-toggle="tab">';
        echo $term->name;
        echo '</a>';
        echo '</li>';
        }  // CLOSE OFF FIRST LOOP 
        echo '</ul>';

        
        foreach ($_terms as $term) :
        $term_slug = $term->slug;
        
        // QUERY
        $_posts = new WP_Query( array(
          'post_type'         => 'testimonial',
          'posts_per_page'    => -1, 
          'tax_query' => array(
            array(
              'taxonomy' => 'filed-under',
              'field'    => 'slug',
              'terms'    => $term_slug,
            ),
          ),
        )); 
        
        // TABBED CONTENT
        echo '<div class="tabs-content" data-tabs-content="example-tabs">';
        echo '<div class="tabs-panel" id="' . $term_slug . '">';
        echo '<ul class="accordion" data-accordion data-allow-all-closed="true">';
        if( $_posts->have_posts() ) :  while ( $_posts->have_posts() ) : $_posts->the_post(); 
        echo '<li class="accordion-item" data-accordion-item>';
        echo '<a href="#" class="accordion-title">';
        echo '<p>';
        the_title(); 
        echo '</p>';
        echo '</a>';
        echo '<div class="accordion-content" data-tab-content>';
        echo the_field('testimonial');
        echo '</div>';
        echo '</li>'; 
        endwhile; endif; wp_reset_postdata();
        echo '</ul>';
        echo '</div>';
        echo '</div>';
        endforeach; 
        ?>

CODE V2

<?php 
        echo '<ul class="tabs" data-tabs id="example-tabs">';
        echo '<li class="tabs-title is-active link-no-style">';
        echo '<a href="#" aria-selected="true">All</a>';
        echo '</li>';  
        $_terms = get_terms(array('filed-under'));
        foreach ($_terms as $term) {
        $term_slug = $term->slug;

        // TABBED HEADERS 
        echo '<li class="tabs-title link-no-style">';
        echo '<a href="#' . $term->slug . '"aria-selected="true" role="tab" data-toggle="tab">';
        echo $term->name;
        echo '</a>';
        echo '</li>';
        }  // CLOSE OFF FIRST LOOP 
        echo '</ul>';

        
        foreach ($_terms as $term) :
        $term_slug = $term->slug;
        
        // QUERY
        $_posts = new WP_Query( array(
          'post_type'         => 'testimonial',
          'posts_per_page'    => -1, 
          'tax_query' => array(
            array(
              'taxonomy' => 'filed-under',
              'field'    => 'slug',
              'terms'    => $term_slug,
            ),
          ),
        )); 
        
        // TABBED CONTENT
        echo '<div class="tabs-content" data-tabs-content="example-tabs">';
        echo '<div class="tabs-panel" id="' . $term_slug . '">';
        echo '<ul class="accordion" data-accordion data-allow-all-closed="true">';
        if( $_posts->have_posts() ) :  while ( $_posts->have_posts() ) : $_posts->the_post(); 
        echo '<li class="accordion-item" data-accordion-item>';
        echo '<a href="#" class="accordion-title">';
        echo '<p>';
        the_title(); 
        echo '</p>';
        echo '</a>';
        echo '<div class="accordion-content" data-tab-content>';
        echo the_field('testimonial');
        echo '</div>';
        echo '</li>'; 
        endwhile; endif; wp_reset_postdata();
        echo '</ul>';
        echo '</div>';
        echo '</div>';
        endforeach; 
        ?>
deleted 47 characters in body
Source Link
 <?php
          // TABBED HEADERS
          echo '<ul class="tabs" data-tabs id="example-tabs">';
          echo '<li class="tabs-title is-active link-no-style">';
          echo '<a href="#all" aria-selected="true">All</a>';
          echo '</li>';
          $args = array(
            'hide_empty'=> 1,
            'orderby'   => 'name',
            'order'     => 'ASC',
            'post_type' => 'testimonial',
            'taxonomy'  => 'filed-under',
          );
          $categories = get_categories($args);
          foreach($categories as $category) { 
            echo 
              '<li class="tabs-title link-no-style">
                <a href="#' . $category->slug . '" aria-selected="true" role="tab" data-toggle="tab">    
                  '.$category->name.'
                </a>
              </li>';
          }
          echo '</ul>';
          
          // TABBED CONTENT
          echo '<div class="tabs-content" data-tabs-content="example-tabs">';
          echo '<div class="tabs-panel is-active" id="' . $category->slug .'">';
          echo '<ul class="accordion" data-accordion data-allow-all-closed="true">';
          
          foreach($categories as $category) { 
            $the_query = new WP_Query(array(
              'post_type'     => 'testimonial',
              'post_status'   => ' publish',
              'category_name' => $category->slug,
            ));
          while ( $the_query->have_posts() ) : $the_query->the_post();
            echo '<li class="accordion-item" data-accordion-item>';
            echo '<a href="#" class="accordion-title">';
            the_title();
            echo '</a>';
            echo '<div class="accordion-content" data-tab-content>';
            echo the_field('testimonial'); 
            echo '</div>';
            echo '</li>';
          endwhile; 
            wp_reset_postdata();
          } 
          echo '</ul></div></div>';
        ?>
        <?php
        // TABBED HEADERS
        echo '<ul class="tabs" data-tabs id="example-tabs">';
        echo '<li class="tabs-title is-active link-no-style">';
        echo '<a href="#all" aria-selected="true">All</a>';
        echo '</li>';
        $args = array(
          'hide_empty' => 1,
          'orderby'   => 'name',
          'order'     => 'ASC',
          'post_type' => 'testimonial',
          'taxonomy'  => 'filed-under',
        );
        $categories = get_categories($args);
        foreach ($categories as $category) {
          echo
            '<li class="tabs-title link-no-style">
                <a href="#' . $category->slug . '" aria-selected="true" role="tab" data-toggle="tab">    
                  ' . $category->name . '
                </a>
              </li>';
        }
        echo '</ul>';

        // TABBED CONTENT
        echo '<div class="tabs-content" data-tabs-content="example-tabs">';
        echo '<div class="tabs-panel is-active" id="' . $category->slug . '">';
        echo '<ul class="accordion" data-accordion data-allow-all-closed="true">';
        foreach ($categories as $category) {
          $the_query = new WP_Query(array(
            'post_type'     => 'testimonial',
            'post_status'   => 'publish',
            'category_name' => $category->slug,
          ));
          while ($the_query->have_posts()) : $the_query->the_post();
            echo '<li class="accordion-item" data-accordion-item>';
            echo '<a href="#" class="accordion-title"><p>';
            the_title();
            echo '</p></a>';
            echo '<div class="accordion-content" data-tab-content>';
            echo the_field('testimonial');
            echo '</div>';
            echo '</li>';
          endwhile;
          wp_reset_postdata();
        }
        echo '</ul>';
        echo '</div>';
        echo '</div>';
        ?>
 <?php
          // TABBED HEADERS
          echo '<ul class="tabs" data-tabs id="example-tabs">';
          echo '<li class="tabs-title is-active link-no-style">';
          echo '<a href="#all" aria-selected="true">All</a>';
          echo '</li>';
          $args = array(
            'hide_empty'=> 1,
            'orderby'   => 'name',
            'order'     => 'ASC',
            'post_type' => 'testimonial',
            'taxonomy'  => 'filed-under',
          );
          $categories = get_categories($args);
          foreach($categories as $category) { 
            echo 
              '<li class="tabs-title link-no-style">
                <a href="#' . $category->slug . '" aria-selected="true" role="tab" data-toggle="tab">    
                  '.$category->name.'
                </a>
              </li>';
          }
          echo '</ul>';
          
          // TABBED CONTENT
          echo '<div class="tabs-content" data-tabs-content="example-tabs">';
          echo '<div class="tabs-panel is-active" id="' . $category->slug .'">';
          echo '<ul class="accordion" data-accordion data-allow-all-closed="true">';
          
          foreach($categories as $category) { 
            $the_query = new WP_Query(array(
              'post_type'     => 'testimonial',
              'post_status'   => ' publish',
              'category_name' => $category->slug,
            ));
          while ( $the_query->have_posts() ) : $the_query->the_post();
            echo '<li class="accordion-item" data-accordion-item>';
            echo '<a href="#" class="accordion-title">';
            the_title();
            echo '</a>';
            echo '<div class="accordion-content" data-tab-content>';
            echo the_field('testimonial'); 
            echo '</div>';
            echo '</li>';
          endwhile; 
            wp_reset_postdata();
          } 
          echo '</ul></div></div>';
        ?>
        <?php
        // TABBED HEADERS
        echo '<ul class="tabs" data-tabs id="example-tabs">';
        echo '<li class="tabs-title is-active link-no-style">';
        echo '<a href="#all" aria-selected="true">All</a>';
        echo '</li>';
        $args = array(
          'hide_empty' => 1,
          'orderby'   => 'name',
          'order'     => 'ASC',
          'post_type' => 'testimonial',
          'taxonomy'  => 'filed-under',
        );
        $categories = get_categories($args);
        foreach ($categories as $category) {
          echo
            '<li class="tabs-title link-no-style">
                <a href="#' . $category->slug . '" aria-selected="true" role="tab" data-toggle="tab">    
                  ' . $category->name . '
                </a>
              </li>';
        }
        echo '</ul>';

        // TABBED CONTENT
        echo '<div class="tabs-content" data-tabs-content="example-tabs">';
        echo '<div class="tabs-panel is-active" id="' . $category->slug . '">';
        echo '<ul class="accordion" data-accordion data-allow-all-closed="true">';
        foreach ($categories as $category) {
          $the_query = new WP_Query(array(
            'post_type'     => 'testimonial',
            'post_status'   => 'publish',
            'category_name' => $category->slug,
          ));
          while ($the_query->have_posts()) : $the_query->the_post();
            echo '<li class="accordion-item" data-accordion-item>';
            echo '<a href="#" class="accordion-title"><p>';
            the_title();
            echo '</p></a>';
            echo '<div class="accordion-content" data-tab-content>';
            echo the_field('testimonial');
            echo '</div>';
            echo '</li>';
          endwhile;
          wp_reset_postdata();
        }
        echo '</ul>';
        echo '</div>';
        echo '</div>';
        ?>
added 10 characters in body
Source Link
Tom J Nowell
  • 60.6k
  • 7
  • 77
  • 147
Loading
added 10 characters in body
Source Link
Loading
Source Link
Loading