Grow your CSS skills. Land your dream job.

“De-randomized grid” of posts

  • # March 20, 2013 at 6:08 am

    Hello

    I really like Chris’ post about a “[Randomized grid of Posts](http://digwp.com/2010/08/randomized-grid-of-posts/ “Randomized grid of posts”)”

    I don’t know php that well, so I would like to hear if you could help with the following:
    In Chris’ post he writes the following for handling the content:

    ” class=”box col< ?php echo rand(2,4); ?>“>
    < ?php the_title(); ?>
    < ?php the_excerpt(); ?>

    As I understand it this part: < ?php echo rand(2,4); ?>, is what “randomizes” the grid by choosing a random number between 2,3 and 4 for each box.

    I would very much like to do the opposite, but I don’t know the command in php. I would like to get a ordered sequence of boxes: 1,2,3,1,2,3,1,2,3 etc.
    Is it possible to change the “echo rand” command so it does the opposite?

    Hope you can help…

    Best
    Simon

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".