• Can someone give me a basic adsense 101 for the following.

    When I write a post I would like to have an adsense block ‘inline’ floated right with text wrapped around. I believe I know how to do this using a div and floatright etc..

    This will give me a post page with:
    Post Heading
    Some text with the adsense block floated right and text wrapped around.
    Then comment section

    Will this adsense block also be displayed on the index page (must recent 10 posts)for this post?

    If yes this means that all my new posts will display an adsense block inline which is against the adsense rules. How do I get around this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Posts are displayed in the Single Post template so this is where you would want to paste your Adsense code. Since it’s in a different template than the main index, your ad will not show up on your front page.

    First, you might want to paste and save your adsense code in a separate file. This will make your Single Post template more clean and it’ll be more easy for you if for some reason you would want to change the code or even use the same code on another template. Let’s say you named the file with the Adsense code “ad-inline-post.php“. Save it in your theme’s directory. Open the Single Post template then add a div inside your entry div, just before “the_content()” tag. Call the ad page with a simple php like this:

    <div class="entry">
       <div class="ad_inline">
          <?php include "ad-inline-post.php"; ?>
       </div>
       <?php the_content(); ?>
       ...
    </div>

    Add the styles for the div (make it float right, set the margins, etc) and you’re done.

    Thread Starter visit-the-coqui

    (@visit-the-coqui)

    Thanks.

    This sounds like a good solution.

    One question.

    The ‘ad-inline-post.php’ file that I create, will thsi file just include the adsense code for the add block?

    Apologies for this extremely basic question but I’m new to PHP.

    Moderator Samuel Wood (Otto)

    (@otto42)

    www.ads-software.com Admin

    Ideally, yes, you would just put your adsense code in that file. The thinking here being that you would be able to then easily include it from other places if you wanted to do so (Pages, for example). That way, you could change it everywhere at once by just editing that file.

    Also, notice how he enclosed it in a DIV and gave it a class? You would want to float that class right in your CSS file with something like this:

    .ad_inline {
    float:right;
    }

    Thread Starter visit-the-coqui

    (@visit-the-coqui)

    Thanks.

    Really appreciate the fast help.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘inline adsense block in a post page only?’ is closed to new replies.