I'm pulling in posts from a specific category using twitter bootstrap carousel rotator. I've looking into double loops but I can't figure out how to implement it.
Here is my loop:
$query = array( 'posts_per_page' => 4, 'cat' => 3); $queryObject = new WP_Query($query); $count = 0; if($queryObject): while($queryObject->have_posts() ) : $queryObject->the_post(); $count++; Pretty much it pulls in 4 posts(which I currently have up) from category 3
<div class="item <?php if($count === 1){ echo " active"; }elseif($count >=4){ echo " "; } ?>"> <div class="span4"> <?php the_content();?> </div><!--end of span4--> </div> What I'm trying to do is repeat the div element <div class="span4">, so essentially something like this. Originally what I have above with the if else statement I got <div class="item"> to have the class active on the first three post and on the fourth post just have nothing. With that it just wasn't rotating, so I'm trying this option.
<div class="item active"> <div class="span4"><?php the content();?></div> <div class="span4"><?php the content();?></div> <div class="span4"><?php the content();?></div> EDIT: For some reason my code is being trimmed off.
I've tried experimenting with the double loop feature but it's not working as I want it too,maybe my logic is off, but with the double loop there's an offset which I don't want. Any suggestion would be nice.
Thanks.