Conditional Not Working
-
Not sure what’s going on here. We want to have this google adsense code show on all pages but the homepage. So to test I put this:
<?php if (is_home()) {
echo 'nothing';
}
else {
echo '<script type="text/javascript"><!--
google_ad_client = "removed";
google_ad_width = 160;
google_ad_height = 600;
google_ad_format = "160x600_as";
google_ad_type = "text_image";
google_ad_channel ="";
google_color_border = "000000";
google_color_bg = "FFFFFF";
google_color_link = "FFFF66";
google_color_text ="000000";
google_color_url = "CAF99B";
//--></script>
<script type="text/javascript"
src="https://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>';
}
?>I’ve used conditionals before with no issues… and I am pretty sure it’s right, but no matter what it’s showing up across the whole site. I even tried changing is_home() to is_single() to see if it would display the “nothing” there, but no luck. I also tried instead of wrapping my echoes in “” regular quotes to use the single quotes (”) and escaping the google adsnese quotes with \ , but still shows across site….
Thanks,
Lindsey
- The topic ‘Conditional Not Working’ is closed to new replies.