• Resolved andymacdonalduk

    (@andymacdonalduk)


    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

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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 } ?>
    Thread Starter andymacdonalduk

    (@andymacdonalduk)

    Ahh, that worked a treat. Thank you very much. Your advice is appreciated. ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Can an If Statement Work in a Sidebar??’ is closed to new replies.