how to display a specific number of posts and repeat
-
I am trying to run the loop showing 4 posts, which goes into a bootstrapped tablist, then show the next 4 posts in a tabbed list and so on.
the logic is messing my brain – here is where I am at.
‘<?php
$ingredients = new WP_Query(‘cat=6&showposts=-1’);
$a = query_posts(‘category_name=my_category’);
$result = count($a);
$count = 1;$i = 1;
while (have_posts() && $i < 5) : the_post(); ?><?php if ($i == 1) echo ‘<ul class=”nav nav-tabs” role=”tablist”>’ ?>
<?php $i++; endwhile; ?>
<?php
echo ‘<div class=”tab-content”>’;
$ingredients = new WP_Query(‘cat=6&showposts=-1’);while($ingredients->have_posts()) : $ingredients->the_post();
$count++
?>
<div role=”tabpanel” class=”tab-pane fade in ” id=”<?php the_ID(); ?>”><?php the_content(); ?></div><?php endwhile; ?>
</div>’
Little bit of a newbie here and just cannot figure out the count.
Any help would be appreciated.
- The topic ‘how to display a specific number of posts and repeat’ is closed to new replies.