Page 1 of 1

if count == 5, 9, 13, 17, 21 etc etc echo....

Posted: Sat Aug 07, 2010 5:11 pm
by awelch
I have a count (of wordpress posts)

if the count of posts equals 5, 9, 13, 17, 21 etc then I want to write some css

Any ideas how to check if the count is the above numbers without doing a switch statement- e.g. is there a way to tell that number sequence?

for example:-

if (($count == 1) {echo " no-margin-left";}
if (($count % 4) == 0) {echo " no-margin-right ";}

and then I want

if count equals 5, 9, 13, 17, 21, etc etc etc then echo " clear-left no-margin-left ";

thanks in advance

andy

Re: if count == 5, 9, 13, 17, 21 etc etc echo....

Posted: Sat Aug 07, 2010 5:20 pm
by mikosiko
(($count - 1) % 4 == 0) maybe?