andymacdonalduk
Member
Posted 1 year ago #
Hey Guys,
Could anybody tell me if an if statement will work in a sidebar please? Basically, I want to include an adsense ad in my sidebar on all pages except single.php.
Is there a way to omit the advert from the sidebar when the single.php page is being used, without creating a whole new sidebar?
Thanks for your time.
Andrew
if you edit it directly into sidebar.php:
<?php
wp_reset_query(); // just in case a custom query had distorted the original query_string
if(!is_single()) { ?>
/*put your adsense code here*/
<?php } ?>
andymacdonalduk
Member
Posted 1 year ago #
Ahh, that worked a treat. Thank you very much. Your advice is appreciated. :-)