一般来说,这应该会产生您所寻找的结构。它有4个单独的WP\\u查询循环,每个循环从名为的类别中提取帖子。
<div id="portfolio">
<div class="col">
<?php
$cat1 = new WP_query(array(\'category_name\' => \'design\'));
if($cat1->have_posts()) :
while($cat1->have_posts()) : $cat1->the_post();
?>
<div class="item">
<?php
if(has_post_thumbnail())
{
the_post_thumbnail();
}
?>
</div>
<?php
endwhile;
endif;
?>
</div>
<!---------------------------------------------------------------->
<div class="col">
<?php
$cat2 = new WP_query(array(\'category_name\' => \'development\'));
if($cat2->have_posts()) :
while($cat2->have_posts()) : $cat2->the_post();
?>
<div class="item">
<?php
if(has_post_thumbnail())
{
the_post_thumbnail();
}
?>
</div>
<?php
endwhile;
endif;
?>
</div>
<!---------------------------------------------------------------->
<div class="col">
<?php
$cat3 = new WP_query(array(\'category_name\' => \'branding\'));
if($cat3->have_posts()) :
while($cat3->have_posts()) : $cat3->the_post();
?>
<div class="item">
<?php
if(has_post_thumbnail())
{
the_post_thumbnail();
}
?>
</div>
<?php
endwhile;
endif;
?>
</div>
<!---------------------------------------------------------------->
<div class="col">
<?php
$cat4 = new WP_query(array(\'category_name\' => \'magazine\'));
if($cat4->have_posts()) :
while($cat4->have_posts()) : $cat4->the_post();
?>
<div class="item">
<?php
if(has_post_thumbnail())
{
the_post_thumbnail();
}
?>
</div>
<?php
endwhile;
endif;
?>
</div>
</div>