<?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>';
?>