Support » Themes and Templates » Changing images in header on different pages

  • I am trying to use WordPress as a CMS
    You can see my s results at
    I am trying to use a different header image on every page. Doing some research I found this method

    Following this method I changed the body tag in my header.php file to:
    <body <?php if (function_exists('body_class')) body_class(); ?>>

    Also added to my CSS:
    body.branding #banner url{background-image:url(images/banner_eiffeltower.jpg);}

    In this case the header image was defined by this tag: <div id=”banner”></div> and the page I was wanting to use a different banner image on had the template called “branding”.

    Anyone can figure out why this is not working?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Michael


    Forum Moderator

    this is the body class of your page ‘branding’:

    <body class="page page-id-3 page-template page-template-branding-php">

    your style did not match.

    your css could look like this: #banner {background-image:url(images/banner_eiffeltower.jpg);}

    thank you! it works. I didn’t what to put after body.

    Hi there, I would really love to get this working also.. where do I put this?

    `<body class=”page page-id-3 page-template page-template-branding-php”>



    Forum Moderator

    you would use ‘body_class()’ in the <body> tag, usually in header.php:

    <body <?php body_class(); ?>>

    Thanks for replying alchymyth – ive got
    <body <?php body_class(); ?>>

    in my header.php, but I see you refer above to

    <body class="page page-id-3 page-template page-template-branding-php">

    should I combine those two? .. and how?

    and then if I want to change the image using say the class “rubberballs” in page-id-4 how do I write that in to the header so it knows?

    any help much appreciated, im thinking ive obviously missed the boat here 🙂 and would love to get this..

    actually alchymyth, I see you may have already answered my question somewhere else for another forum member

    So tomorrow I will have a go – it looks like what im after 🙂 – will post back here for others with the same issue!

    thanks in advance!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Changing images in header on different pages’ is closed to new replies.