WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Background images (4 posts)

  1. caughtredhanded
    Member
    Posted 4 years ago #

    This is my blog.

    At the moment, I have one background image that is the same for every single page of my site, however soon I am wanting to include a banner just under my nav bar and above my posts on the homepage, however I don't want these to be showing on any other pages.

    With that in mind, how do I go about breaking up my background image, or having different background images on different pages so that I can accommodate having different content on different pages?

    I'm aware of conditional tags, which is fine, but I don't see how to get different background images on different pages.

    Cheers!

  2. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    having different background images on different pages

    in header.php, after the lines with <link rel='stylesheet'... and before </head> , add something like:

    <style type="text/css">
    <?php if(is_page('about')) { ?>
    body { background-image: url(images/bg_about.png);
    <?php }
    elseif (is_page('archives')) { ?>
    body { background-image: url(images/bg_archives.png);
    <?php } ?>
    </style>

    how do I go about breaking up my background image

    difficult to do, the way it designed at the moment.

  3. caughtredhanded
    Member
    Posted 4 years ago #

    When I add that in I get a blank background image. Is it because I'm using conditional tags already further down in my header.php?

  4. caughtredhanded
    Member
    Posted 4 years ago #

    Problem solved. I simply used body_class and altered my css to reflect it. Now it's working exactly the way that I wanted it. Lovely...

Topic Closed

This topic has been closed to new replies.

About this Topic