是的,它非常简单,您只需要在PHP中工作。
假设您在一个循环中有36个帖子。
$div_html_1 = \'\';
$div_html_2 = \'\';
$div_html_3 = \'\';
$div_html_4 = \'\';
$div_html_5 = \'\';
$div_html_6 = \'\';
if ( have_posts() ) {
while ( have_posts() ) {
if( category of post == division 1 ) {
$div_html_1 .= "Your HTML here";
} elseif( category of post == division 2 ) {
$div_html_2 .= "Your HTML here";
}
and so on....
}
}
在布局中,您的代码如下:,
<div id="prefix_div_one">
<?php echo $div_html_1; ?>
</div>
<div id="prefix_div_two">
<?php echo $div_html_2; ?>
</div>
and so on...