2011-09-20 2 views

답변

5

% 연산자를 사용해 보셨습니까? (테스트되지 않은) 다음과 같은 뭔가 :

if(have_posts()) : 
$i=0; 
while ($wp_query->have_posts()) : $wp_query->the_post(); 
$i++; 
?> 
<li <?php if(($i % 3)==0)echo 'style="background:green"';?>>Test</li> 
<?php endwhile; ?> 
<?php endif; 

PHP 참조 : http://php.net/manual/en/language.operators.arithmetic.php