WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How do you wrap text around Adsense ad? (4 posts)

  1. midlife mama
    Member
    Posted 1 year ago #

    Working on my child theme for Twenty Twelve and with the help of this forum figured out how to add Adsense to single post page. I learn to add code to content.php

    <?php if ( is_single() ) : ?>
    		ADSENSE CODE
    <?php endif; ?>

    The ad appears on single post page--great, and is right below the blog title--great. But the text doesn't wrap around it. I've tried playing around with the style.css but since I'm still very much learning, I haven't had much luck.

    I'd like to float it to the left with 10px padding on the right and below.

    Can someone help?

  2. alchymyth
    The Sweeper & Moderator
    Posted 1 year ago #

    for instance, wrap the adsense code into a div with the css class .adsense or so, or with inline styles;

    example:

    <?php if ( is_single() ) : ?>
    <div class="adsense">
    		ADSENSE CODE
    </div>
    <?php endif; ?>

    you can then style this in style.css; example:

    .adsense { float: left; margin-right: 10px; }

  3. midlife mama
    Member
    Posted 1 year ago #

    You are a Super Star! Thank you. It worked.

    Just a quick aside for others who may read this: I first added the code to the style.css towards the end and it didn't work. Just for fun, I moved the code toward the beginning of the style sheet, and VIOLA, it worked. So I'm learning that it's not just code, it's proper placement too.

  4. tharun782@gmail.com
    Member
    Posted 7 months ago #

    That really worked for me. Could you please tell me how to wrap the adsense code to left or right below post title...

Topic Closed

This topic has been closed to new replies.

About this Topic