- This topic is empty.
Viewing 4 posts - 1 through 4 (of 4 total)
Viewing 4 posts - 1 through 4 (of 4 total)
- The forum ‘Back End’ is closed to new topics and replies.
The forums ran from 2008-2020 and are now closed and viewable here as an archive.
I would like the front page to echo class=”none”
Sadly, it is echoing class=”GATSBG1″
<?php if ( is_page (array('75-chrome-shop', '75-chrome-shop-galleries', '75-chrome-shop-winners')) || in_category('75-chrome-shop')) {
echo 'class="chromeBG" ';
} elseif ( is_page (array('fitzgerald-truck-show', 'fitzgerald-winners', 'fitzgerald-galleries')) || in_category('fitzgerald')) {
echo 'class="fitzgeraldBG"';
} elseif ( is_page (array('the-great-american-trucking-show', 'gats-galleries', 'gats-winners' )) || in_category('gats')) {
echo 'class="GATSBG1"';
} elseif ( is_page('driver-profiles')) {
echo 'class="GATSBG2" ';
} elseif ( is_front_page()) {
echo 'class="none" ';
} else {
echo 'class="GATSBG3"';
}
?>
Thanks!
Obviously, it’s getting class GATSBG1 because of your home page matches this condition:
is_page (array('the-great-american-trucking-show', 'gats-galleries', 'gats-winners' )) || in_category('gats'))
And so it will skip checking all the other conditions (including the check if it’s the home page).
If you want to set it to “none” on the home page no matter what, then you should start your entire check with that condition:
if ( is_front_page()) {
echo 'class="none" ';
} else {
// all your other stuff here
}
Yea it is strange because the home page is none of those pages nor in that category.
But moving it to the top is a good idea.
Thanks again.
is_front_page()
will return true
if:
or
You can find more information including the description here: http://codex.wordpress.org/Function_Reference/is_front_page
Hope that helps,
Alen