SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Addict
    Join Date
    May 2010
    Posts
    229
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    adding class to home with php help

    with the theme i'm using, it adds a class to all pages except the homepage.

    here's the code that's in place in the header.php file:
    Code:
    <body <?php if(!is_home()) { echo ' class="innerpage"'; } ?>>
    i'm not that handy with php but i think what this is saying is... if it's not the homepage, then add the class of "innterpage". But how do I make it also has code that says, if it IS the homepage, it has a class of "home"?

    please advise. thanks in advance!

  2. #2
    SitePoint Addict
    Join Date
    Apr 2011
    Posts
    265
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Hi,
    Try this code, with if() ... else ...
    PHP Code:
    <body <?php if(!is_home()) { echo ' class="innerpage"'; } else { echo ' class="home"'; } ?>>
    Free: Web Programming Courses HTML, CSS, Flash
    Web Programming: AJAX Course and PHP-MySQL Course video Lessons
    Good JavaScript and jQuery course for beginners

  3. #3
    SitePoint Addict
    Join Date
    May 2010
    Posts
    229
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    thank you!


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •