php który za to odpowiada
<?php $c = 0; $color_id = 'grey'; ?> <?php while (have_posts()) : the_post(); ?> <?php $c++; // increment the counter if( $c % 2 != 0) { $color_id = 'grey'; } else { $color_id = 'white'; } ?>
<?php $c = 0; $color_id = 'grey'; ?> <?php while (have_posts()) : the_post(); ?> <?php $c++; // increment the counter if( $c % 2 != 0) { $color_id = 'grey'; } else { $color_id = 'white'; } ?>
<?php $c++; // increment the counter $restOfDiv = $c%3; if( $restOfDiv === 2) { $color_id = 'grey'; } elseif ($restOfDiv ===1) { $color_id = 'green'; } else { $color_id = 'white'; } ?>
<?php $c++; // increment the counter if( $c%3 === 0) { $color_id = 'grey'; } elseif ($c%2 !== 0) { $color_id = 'green'; } else { $color_id = 'white'; } ?>