Create PHP Counter Using While Loop

if($post->have_posts()) {
     $i = 1;
} while($post->have_posts()) {


This will create a counting instance, that you can add inline to any elements that need intervals applied.  Simple echo $i;

Sourced here.

Leave a Reply

Posted in php
katherine as a flat graphic icon

About Me

I’m an African / Ojibwe First Nations Web Developer living in Winnipeg, Manitoba.

Visit the Tips and Blog to see what I’m working on.