• Resolved TimWurst

    (@timwurst)


    Hello.

    I’m using Tanzaku theme and I’m trying to make it look a bit like a messed-up desktop. So I would like to have a different (random) background image for every post. So in the end it should (roughly) look like this: Picture

    I managed to give the boxes a random bg-image, but then of course all the post on the site have the same background. Any idea how to do have them have different ones?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Also interested in this.

    try to add a new class to the posts, with a reference to a random background; such as
    .bg-random-4

    edit index.php of tanzaku;
    find line 104:

    <div <?php post_class('grid-item ' . $col_class); ?> id="post-<?php the_ID(); ?>">

    change to:

    <?php $bg_random = 'bg-random-'.rand(1,10); ?>
    		<div <?php post_class(array('grid-item ' . $col_class,$bg_random)); ?> id="post-<?php the_ID(); ?>">

    rand(1,10) would create random nunbers in the range from 1 to 10 – adjust to your level of randomness.

    at the end of style.css, add for instance:

    .grid-item.bg-random-1 { background: #66FF00; }
    .grid-item.bg-random-2 { background: #33FF00; }
    .grid-item.bg-random-3 { background: #66bb00; }
    .grid-item.bg-random-4 { background: #66FF77; }
    .etc..

    one style for each possible random nunber; full range of background css possible.

    Thread Starter TimWurst

    (@timwurst)

    Great. This works just perfect!!!

    Thank you so much for your help!

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Tanzaku: Different backgrounds for posts?’ is closed to new replies.