这对你有好处
$total_posts = $wp_query->post_count;
if($total_posts = 1){
$div_class="single-post";
}elseif($total_posts > 1)}
$div_class= "multiple-posts";
}
放在后面
<?php while(have_posts()) : the_post(\'\');
这样它就会变成
<?php
while(have_posts()) : the_post(\'\');
$total_posts = $wp_query->post_count;
$div_class = \'\';
if($total_posts = 1){
$div_class="single-post";
}elseif($total_posts > 1)}
$div_class= "multiple-posts";
}
?>
<div class="divider over <?php echo $div_class; ?>">
然后将$div\\u类回显到要向其中添加类的特定元素。