Wrap a query in a div
-
I’m creating a site that lists of blog posts in 6 categories. I have the loop set up the way I want with one exception. I want to wrap each category in a <div>. If I have each query create a <div>, it creates <div>s for every post title. Any suggestions? Where can I insert those <div> tags?
function giftlist_indexloop() { query_posts("posts_per_page=10"); if (have_posts()) : while (have_posts()) : the_post(); ?> <?php echo "<h3><a href='"; the_permalink(); echo "'>"; the_title(); echo "</a></h3>"; ?> <?php endwhile; else: ?> <h2>Eek</h2> <p>There are no posts to show!</p> <?php endif ; wp_reset_query(); query_posts("posts_per_page=10&cat=3"); if (have_posts()) : while (have_posts()) : the_post(); ?> <?php echo "<h3><a href='"; the_permalink(); echo "'>"; the_title(); echo "</a></h3>"; ?> <?php endwhile; else: ?> <h2>Eek</h2> <p>There are no posts to show!</p> <?php endif; wp_reset_query(); query_posts("posts_per_page=10&cat=4"); if (have_posts()) : while (have_posts()) : the_post(); ?> <?php echo "<h3><a href='"; the_permalink(); echo "'>"; the_title(); echo "</a></h3>"; ?> <?php endwhile; else: ?> <h2>Eek</h2> <p>There are no posts to show!</p> <?php endif; wp_reset_query(); ...
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Wrap a query in a div’ is closed to new replies.