• Resolved Connor Crosby

    (@ccmovies)


    Hello,

    I am making a wordpress theme and want to display the date of the post on a “sticky note” and I do not want every sticky note to look the same. For example, I would like one to be straight, and the next time I post something, the sticky note is a little crocked. So, it would switch between a couple of “stick note” images I have made. How would I do this?

    Thanks,
    Connor

Viewing 2 replies - 1 through 2 (of 2 total)
  • add a random number to the style of the post date div; for instance:
    (as you haven’t posted the code that you are using)

    <div class="post-date note-<?php echo rand(1,5); ?>"><?php the_time('Y M d'); ?></div>

    and in style.css:

    .post-date.note-1 { background-image: url(images/sticky-note-1.png); }
    .post-date.note-2 { background-image: url(images/sticky-note-2.png); }
    etc.

    http://php.net/manual/en/function.rand.php

    Thread Starter Connor Crosby

    (@ccmovies)

    Oh that is awesome, thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Multiple Backgrounds (switch between them)’ is closed to new replies.