• I am using the Adsense Deluxe plugin to display Google Adsense ads. I want to display a particular ad only on my blog directory page. I am using this code but the ad isn’t displaying:

    <?php if (is_page('garden-blog-directory')) {; ?>
    			<?php adsense_deluxe_ads('blog_directory_sidebar'); ?>
    			<?php } ?>

    Can anyone tell me what I am doing wrong? I figure I am missing punctuation somewhere.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Try this instead:

    <?php if (is_page(‘garden-blog-directory’)) adsense_deluxe_ads(‘blog_directory_sidebar’); ?>

    Should work, all things being equal ??

    Thread Starter Kathy_P

    (@kathy_p)

    Thanks for replying, gfindlay, but that didn’t work.
    This code works at the beginning of the sidebar:

    <?php if (is_page('garden-blog-directory')) {; ?>
    <?php adsense_deluxe_ads('blog_directory_sidebar'); ?>
    <?php } else { ; ?>
    <?php adsense_deluxe_ads('Sidebar'); ?>
    <?php } ?>

    So I would think I’m just ending it incorrectly when I don’t need the “else.” According to the Adsense Deluxe plugin, “If you want to use the ads defined in Adsense-Deluxe within your WordPress templates, place the following code where you want the ads to appear:
    <?php adsense_deluxe_ads('Ad_Name'); ?>” I’ve tried comparing my problem code with code in my templates that does work, and I just can’t see what I’m doing wrong. I haven’t gone over Google’s limit for number of ads on a page, so I don’t think that’s it either. Still scratching my head.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional php code not working’ is closed to new replies.