Support » Fixing WordPress » Page div background

  • Resolved SpeedyLeon


    Hi guys,

    Before we start, I am using a child theme, but I cannot post the link to the website, but I do not believe that this question requires any ‘visual aids’.

    Essentially, WordPress twentyeleven has a div id=”page” class=”hfeed”, I was wondering, is there a way to make it so that, on the home page, the CSS is set to have no background, and on every other page, the CSS is set to have a background? If it is possible, how would I go about achieving such a thing?

Viewing 4 replies - 1 through 4 (of 4 total)
  • create a template page for the homepage and change the div id to something else, ex- <div id=”pagehome”>

    then set the css:
    #pagehome {background:none;}

    That might be the easiest way.

    I dont think thats quite what I mean.

    In header.php you have the following:

    <body <?php body_class(); ?>>
    <div id="page" class="hfeed">
    header id="branding" role="banner">


    I was hoping to be able to call that div conditionally. So that if its the homepage, it will call div id=”page” with a different class (say, class=”home”) and if it wasnt the home page, it would call it with class=”hfeed”.

    Is such a thing doable?

    Wop, lets backtrack! 😛

    Thanks Tom, your post gave me a good idea of an alternative way to solve my problem using your advice, I really appreciate the help =]

    Have a good one.

    I’m not 100% sure, but I don’t think you can apply separate set of attributes the same id or class.

    I think you’ll have to create a second page id, but rather than creating a template page, you could use and if/else statement.

    Try something like this:
    #pagenobackground {background:none;}

    then in your header use this:

    // HOME
    if ( is_page('home') ) {?>
    <div id="pagenobackground" class="hfeed">

    <?php }
    else { // all other pages ?>
    <div id="page" class="hfeed">
    <?php } ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Page div background’ is closed to new replies.