trouble with closing div's in multiple wp_query loops
-
There are 3 wp_query’s called, and each needs its own div. However, a div should only open and close if there are appropriate posts. I can get this to work if all have content with the end div in one spot, or it will work if only 2 have content with the /div in another spot. But I can’t get to work for both cases — if a page has all three and another has just 2.
<div class="row"> <?php $tags = wp_get_post_tags($post->ID); if ($tags) { $args=array( 'caller_get_posts'=>1 ); $my_query = new WP_Query($args); if( $my_query->have_posts() ) { ?> <div class="columns four resource-list case"> <h4>title</h4> <?php while ($my_query->have_posts()) : $my_query->the_post(); ?> <?php the_excerpt(); ?> <?php endwhile; } ?> </div> <?php wp_reset_query(); // Restore global post data stomped by the_post(). } ?> <!-- repeat the above php 2 more times --> </div>
I’ve tried after excerpt, after endwhile, and after php.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘trouble with closing div's in multiple wp_query loops’ is closed to new replies.