I have the following thats within a loop…
echo "<span class='srch-val'>".apply_filters(" $value\n", $value)."</span>";
I want to somehow add a number or something after the class ‘srch-val-1’ without using jQuery, is this possible using PHP? If so where can I find out how to do this? thanks
Its currently within a foreach() loop…
foreach ( (array) $keys as $key ) { //Stuff }
$your_value can be everything you want , including a number..
A very simple loop example
will return
or for example – in a wordpres loop , you can even do
or
and so on … any available value can be applied . of course you then have to think how to TARGET an over changing class with CSS – but that is for another question,.
EDIT I – as for comment for the loop inside loop – the above was just a generic example – you need to put the counter in the beginning of your original loop and increment it on the end . (if it is a wordpress loop like i suspect, put $i=1 , or any other number , after the
if (have_posts())or after thewhile (have_posts())-depending on where you need it – and the incrementing$i=$i++at the end. (before theendif;orendwhile;– again depending on your needs…)