Forums

conditional tags / background image (5 posts)

  1. aero313
    Member
    Posted 1 year ago #

    hi all,

    I am trying to get the homepage background to be different from the background that appears on all other pages. I tried to put a conditional tag on it, but I can't get it to work. Any ideas?

    http://03145e2.netsolhost.com/PLight/

  2. Rev. Voodoo
    Volunteer Moderator
    Posted 1 year ago #

    where did you do the conditional?

    it would not work in style.css, php doesn't work in a css file

    You would need to include the conditional up in your header.php file between the <head></head> tag

    what conditional did you use?

  3. aero313
    Member
    Posted 1 year ago #

    I did this in my header.php file:

    <body
    id="<?php if (is_page_template('index.php')){
    echo "home";
    } else{
    echo "default";
    }?>" >
    <div id="wrapper" class="hfeed">
    <div id="header">
    <div id="masthead">
    <div id="branding" role="banner" height="150px">

    </div>

  4. threestyler
    Member
    Posted 1 year ago #

    The best way would be to simply replace your body tag with: <body <?php body_class(); ?>>

    You can then style all these elements:

    http://codex.wordpress.org/Template_Tags/body_class

  5. aero313
    Member
    Posted 1 year ago #

    thanks. I'm still missing something though —— what goes after the first line to add the styles?

    <?php if (is_page_template('index.php')){
    echo "home";
    } else{
    echo "";
    }?>
    </head>

Topic Closed

This topic has been closed to new replies.

About this Topic