From what I understand, you want to print out an unordered list with each list item having a unique class that increases by 1 each time a list item is printed?
I don't have any exprience with Wordpress, but could this not be easily done with a variable that you increase each time a list item is printed?
For example:
<ul>
<li class="<?php echo "img","$i"; ?>>link</li><?php $i++; ?>
<li class="<?php echo "img","$i"; ?>>link</li><?php $i++; ?>
<li class="<?php echo "img","$i"; ?>>link etc...</li><?php $i++; ?>
</ul>
Alternatively, you could create a function that does the following:
1) Print out the number
2) Increase the value of the number by one so that the next time the function is called it prints out a higher value
This would then allow you to do the following:
function classImg() {
echo "img", "$i";
$i++;
}
<ul>
<li class="<?php classImg(); ?>>link</li>
<li class="<?php classImg(); ?>>link</li>
<li class="<?php classImg(); ?>>link etc...</li>
</ul>
I have written this off the top of my head and so there are probably errors but I hope you understand what I am getting at.