Till now i have listed the category in tabs. But did not get the news and its description under the category. And in database the news are treated as post’s.
And I am using the jquery tabs for displaying news..
MY CODE:—
<?php
/*
Template Name: tabbing
*/
?>
<?php get_header(); ?>
<div id="tab">
<?php
//list terms in a given taxonomy (useful as a widget for twentyten)
$taxonomy = 'news-category';
$tax_terms = get_terms($taxonomy);
?>
<ul class="nav nav-tabs" role="tablist">
<?php $counter = 0; foreach ($tax_terms as $tax_term) { ?>
<li role="presentation" class="post-<?php ?> <?=($counter == 1) ? 'active' : ''?>"><a href="#post-<?php ; ?>" aria-controls="home" role="tab" data-toggle="tab"><?php echo $tax_term->name; ?></a></li>
<?php $counter++; } //exit; ?>
</ul>
/* Right all description is displaying but not according to the category... */
<div class="tab-content">
<?php
$counter = 0;
$loop = new WP_Query( array( 'post_type' => 'news', 'posts_per_page' => -1 ) );
while ( $loop->have_posts() ) : $loop->the_post();
$counter++;
?>
<div role="tabpanel" class="tab-pane <?=($counter == 1) ? 'active' : ''?>" id="post-<?php the_ID(); ?>"><?php the_content();?></div>
<?php endwhile; ?>
</div>
</div>
<?php get_footer(); ?>