WordPress.org

Ready to get started?Download WordPress

Forums

Changing images in header on different pages (7 posts)

  1. TSemmes
    Member
    Posted 4 years ago #

    I am trying to use WordPress as a CMS
    You can see my s results at http://www.eightfoldstrategy.com.
    I am trying to use a different header image on every page. Doing some research I found this method
    http://quirm.net/2009/08/07/changing-headers-with-wordpress-body_class/

    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?

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

    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:
    body.page-template-branding-php #banner {background-image:url(images/banner_eiffeltower.jpg);}

  3. TSemmes
    Member
    Posted 4 years ago #

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

  4. deliwasista
    Member
    Posted 4 years ago #

    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">

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

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

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

  6. deliwasista
    Member
    Posted 4 years ago #

    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..

  7. deliwasista
    Member
    Posted 4 years ago #

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

    http://wordpress.org/support/topic/385590?replies=14

    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!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.