Forums

Add Adsense between post (2 posts)

  1. binbin
    Member
    Posted 3 years ago #

    Hello,

    I try to add an adsense block into my wordpress theme template, just after the first post.

    I have found a tutorial to do this here : http://www.tamba2.org.uk/wordpress/adsense/

    But there's a problem of syntax or it's me I don't understand :

    It said to add adsense code :

    <?php if ($postnum == $showadsense1) {
    echo '
    Your adsense code goes here
    ';
    } ?>
    
    <?php $postnum++; ?>

    So if I do this I have something like that :

    <?php if ($postnum == $showadsense1) {
    echo '
    <script type="text/javascript"><!--
    google_ad_client = "pub-0000000000000";
    /* 200x200, date de création 04/05/09 */
    google_ad_slot = "000000000";
    google_ad_width = 200;
    google_ad_height = 200;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>
    ';
    } ?>
    
    <?php $postnum++; ?>

    And as you can see the syntax is not correct...

    Who could help me please ?

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    Did you actually try this out? It looks OK to me.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags