Adding a random number to post_class
-
Hi everyone
I am working on a site want to have three random column widths. I found an example that hows me how to generate the random number for the class
<a href="<?php the_permalink(); ?>" class="box col<?php echo rand(2,4); ?>">... </a>
but in my theme I am using post_class() so I am not sure how to add the echo rand statement.
<article id="post-<?php the_ID(); ?>" <?php post_class('box col'); ?>> ... </article>
I am still learning all this and have tried how I thought it should be concatenated but none of them worked. If someone could point me in a direction or tell me a better way it would be greatly appreciated
Thx
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Adding a random number to post_class’ is closed to new replies.