• Hi guys,

    I’m trying to add a x600 adsense banner in my sidebar which will only be visable when the reader clicks on a single post.

    I’ve read some tutorials which say to add the adsense code in the single.php file (which I don’t have, so I’m using my index.php file) like this;

    <?php
    if (is_single()) { echo ‘
    Your adsense code goes here
    ‘;} ?>

    When I do this the ads appear under the posts and not in the sidebar. Where abouts do you think I should put my code? Any help is much appreciated!

    Here is my entire index.php code incase it helps;

    [useless long code moderated]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ivyology

    (@ivyology)

    I got a new theme so problem solved (kinda)

    Well, you are supposed to put that piece of code in sidebar.php (most likely anyway). And instead of echo-ing the code out, you should do something like this:

    <?php
    if(is_single()){
    ?>
    AdSense code here
    <?php } ?>

    It saves a lot of hassle.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘adding adsense to sidebar loop..?’ is closed to new replies.