I need to have 8 of these on a single page. Each post list will be in its own numbered switch tab.
Is there a better, more efficient way of doing it?
<div id="tab1">
<div class="content">
<ul>
<?php
// The Query
query_posts( array ( 'category_name' => 'CV', 'posts_per_page' => -1 ) );
// The Loop
while ( have_posts() ) : the_post(); ?>
<h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
<p><?php the_content(); ?></p>
<?php endwhile;
// Reset Query
wp_reset_query();
?>
</ul>
</div><!-- / .content -->
</div><!-- / #tab1 -->
EDITED TO ADD FINAL CODE:
<?php
// getting only children of category ID 16
$categories = get_categories('child_of=16');
// do not need to check for empty categories
{
?>
<ul class="tabs">
<?php foreach ($categories as $c ) { ?>
<li>
<a href="#tab<?php echo $c->term_id; ?>">
<img src="<?php bloginfo('template_directory'); ?>/images/logo-<?php echo $c->slug; ?>.png" alt="<?php echo $c->name; ?>" />
</a>
</li>
<?php } ?>
</ul> <!-- / .tabs -->
<?php } ?>
<?php { foreach ($categories as $c ) { ?>
<div id="tab<?php echo $c->term_id; ?>">
<a href="#" class="left-button"><img src="prev.png" alt="Prev" /></a>
<div class="content">
<?php
$q = new WP_Query( array( 'posts_per_page' => -1, 'cat' => $c->term_id ) );
if ( $q->have_posts() ) : ?> <ul class="tabs-content"> <?php while( $q->have_posts() ) : $q->the_post();
?>
<li>
<h3>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
<?php the_title(); ?></a>
</h3>
<?php the_content(); ?>
</li>
<?php endwhile; ?> </ul> <?php endif; wp_reset_postdata(); ?>
</div><!-- / .content -->
<a href="#" class="right-button"><img src="next.png" alt="Next" /></a>
</div><!-- / #tab<?php echo $c->term_id; ?> -->
<?php } } ?>