How to put ads next to content (3 posts)

  1. klippert
    Posted 3 years ago #

    Hi I want to know how to put my adsense ads beside content. I know i can use

    $paragraphAfter= 0; //display after the first paragraph
    $content = apply_filters('the_content', get_the_content());
    $content = explode("</p>", $content);
    for ($i = 0; $i <count($content); $i++ ) {
    if ($i == $paragraphAfter) { ?>
    <div><script type="text/javascript"><!--
    google_ad_client = "ca-pub-1899371351571952";
    /* Content head */
    google_ad_slot = "2921193851";
    google_ad_width = 336;
    google_ad_height = 280;
    <script type="text/javascript"
    <?php }
    echo $content[$i] . "</p>";
    } ?>

    [Please post code or markup snippets between backticks or use the code button. Your posted code may now have been permanently damaged by the forum's parser.]

    to make ads appear through out it but it does not make it look like it is part of the content like i want it to. it just makes a blank block and inserts the ad there. i want to make the ad flow into the content like a picture would, beside my content

  2. Install WP
    Posted 3 years ago #

    Using div styling usually works fine, try this

    <div style="margin: 0px 10px 0px 5px; display: block; float: left;">

  3. klippert
    Posted 3 years ago #

    Where would I put that in the wp code

Topic Closed

This topic has been closed to new replies.

About this Topic