You may use something like this
<?php
query_posts( array( 'category__and' => array(1,3), 'posts_per_page' => 2) );
if (have_posts()) : while (have_posts()) : the_post();
$src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), array( 1680,470 ), false, '' );
?>
<div id="header-hero" style="background-image: url('<?php echo $src[0]; ?>');">
// Put your 8 logic here
<?php endwhile; endif; ?>
<?php wp_reset_query(); ?>
Thread Starter
enqis
(@enqis)
<?php
query_posts('cat=8');
$postCount = 0;
while (have_posts()) : the_post();
if ($postCount==0) {echo "<div class='wrapper'>";};
echo "<a href='#' class='featured-img'>";
the_post_thumbnail();
echo "</a>";
$postCount++;
if ($postCount==8) {echo "</div>"; $postCount=0;};
endwhile;
if ($postCount<8 || $postCount>0) {echo "</div>";};
echo $postCount;
?>
I have written something like this. It works well however query show only 10 posts and it ends. How to solve this and make query show all posts in category.