| | #1 |
| HyperActive Warrior War Room Member Join Date: 2009 Location: Denmark
Posts: 213
Thanks: 8
Thanked 5 Times in 5 Posts
|
Hey all I'm trying to display seperate body classes for the home page and the inner pages. I have written this into my index.php <body class="<?php if (page-id-5){ echo "body-home"; } else { echo "body-other"; } ?>"> It does work for the front page (page-id-5), but it just puts in "body-home" on the inner pages as well. Any ideas? Kind regards |
| AllRound Invoice - Small Business Invoicing | |
| |
| | #2 |
| Peaceful Warrior War Room Member Join Date: 2009 Location: Calgary
Posts: 277
Thanks: 16
Thanked 106 Times in 63 Posts
|
The trouble is that if (page-id-5) isn't a proper statement, so it always returns true. Assuming that you're using Wordpress, the is_page() function oughtta do the trick. Code: if (is_page('5')){
// do stuff for page with ID 5
} else {
// do this for every other page
} -Ryan |
| FREE WSO: Protect and Automatically Deliver Your Digital Products Ask the Internet Marketing Geek <-- Happy to help with technical challenges MiniSiteMaker.org <-- Free software to make your mini-sites fast and easy | |
| |
| The Following User Says Thank You to theIMgeek For This Useful Post: |
| | #3 | |
| HyperActive Warrior War Room Member Join Date: 2009 Location: Denmark
Posts: 213
Thanks: 8
Thanked 5 Times in 5 Posts
|
Thank you that did the trick | |
| AllRound Invoice - Small Business Invoicing | ||
| |
|
| Bookmarks |
| Tags |
| ifthen, php |
| |