• Is there a code that lets you have a different background for each post depending on its category? I tryed with the category image script but it didn’t work.
    Please help
    Marzar

Viewing 3 replies - 1 through 3 (of 3 total)
  • There isn’t anything written at the moment that does what you’re looking for, but I do not believe that it would be terribly hard to create something with the functionality you’re looking for. Forgive me for not writing for you myself, but it’s Friday, but the sun and tequila have taken their toll on me. I will, however, point you in the right direction.
    What you will wish to do is write a function like so:
    function post_back_ground($category = “general”) {
    return “images/cat_background/”. $category .”_background.jpg”;
    }
    All you will have to do then is create a div tag which encompasses the entire post, say like this:
    <div style=”background-image: top left <?php post_back_ground(the_category()) ?> no-repeat”>##all the post text</div>
    Simply put an image per category name into some directory, ie we used /images/cat_background/(category_name)_background.jpg”. Then, the function will simply set the background to whatever the name of the cat is of the div we set around the post …. I think that makes sense. If it doesn’t, let me know and I’ll write it tommorow when I’m less … well drunk. I guess I should add my usual “voila”, but I won’t cause I’m not sure that works 😉

    sorry to bump an old post, but could someone give a template for this as this si something I would like to do within 1.5beta.

    I can understand some of it, but honestly it looks a little….unclear?

    Thanks in advance

    I would really like some help with this same thing. Has this been done since this post?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Category background image’ is closed to new replies.