Pages

Monday 15 December 2014

Magento:: Insert a class in foreach loop for every 5th li element

1- Take a variable and assign to 0. like
<?php $counter=0; ?>
2- And give the condition in the li tag as follows.
<li class="product <?php if($counter%5==4): echo "last";  endif;?>"> // for fifth element

No comments:

Post a Comment