• I’m trying to add a Google AdSense block to my sidebar, but I want it to display on posts only, not pages, home page, category nor tag listings.

    Here’s what I have, but nothing is showing up. What am I doing wrong? I’m not a programmer by any means — this is just want I pieced together from other Google searches. Seems like it should work to me, though.

    <?php if (is_single()) : ?>
    <?php include(TEMPLATEPATH.'/sidebar-adsense.php'); ?>
    <?php endif; ?>
Viewing 1 replies (of 1 total)
  • Thread Starter godrox

    (@godrox)

    In case it helps, another query from earlier in my template file is coded like this and seems to work:

    <?php if (!is_404() && !$wp_query->post_count == 0) : ?>
    	<?php include(TEMPLATEPATH.'/widget-popular.php'); ?>
    <?php endif; ?>

    Not sure exactly what that means, though. These code snippets are located in my template’s index.php file. I don’t have a sidebar.php file. The index.php calls for the other files that load the content into the sidebar.

Viewing 1 replies (of 1 total)
  • The topic ‘Showing ad in sidebar for posts only’ is closed to new replies.