Я пытаюсь использовать оператор switch в цикле worpdpress для изменения классов в div, но счетчик увеличения ($ IntCounter), похоже, не срабатывает внутри цикла:
<?php
global $intCounter;
$intcounter = 0;
query_posts('category_name=clients&posts_per_page=3&tag=new-work');
if(have_posts()) : while(have_posts()) : the_post();
$intcounter++;
switch ($intcounter){
case 1:
$ThisPostCSSClass ="new-work-post span-7 colborder ";
break;
case 2:
$ThisPostCSSClass ="new-work-post span-8 colborder ";
break;
case 3:
$ThisPostCSSClass ="new-work-post span-7 last";
break;
default:{
$ThisPostCSSClass="noclass";
}
}
?>
<div class="<?php echo $ThisPostCSSClass;?>" id="<?php the_ID(); ?>">
<div class="">
<?php the_content(); ?>
<h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
<?php the_excerpt(); ?>
</div>
</div> <!-- .post -->
<?php endwhile;endif; ?>
Я упускаю что-то очевидное? Спасибо