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

    <?php
    
    $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>
    <script type="text/javascript"
    src="https://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script></div>
    
    <?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

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to put ads next to content’ is closed to new replies.