How do I put an adsense ad in the middle of my wordpress page?

15 replies
  • SEO
  • |
I have been searching the internet for sometime now and can't seem to find out how you ad an adsense add to the middle of your page.

Here's an example of what I'm talking about.

I've seen a bunch of other sites doing this as well, and was wondering if there was a tutorial or step by step guide someone could point me to. Thanks.
#adsense #middle #page #put #wordpress
  • Profile picture of the author vtotheyouknow
    Originally Posted by Kamikazee View Post

    I have been searching the internet for sometime now and can't seem to find out how you ad an adsense add to the middle of your page.

    Here's an example of what I'm talking about.

    I've seen a bunch of other sites doing this as well, and was wondering if there was a tutorial or step by step guide someone could point me to. Thanks.

    Use: <div style="float:right">Adsense Code</div> if you want the adsense ad on the right with text wrapping around it on the left and use float:left if you want the ad on the left.

    If that detox site is yours, you might want to throw up a privacy policy before Big G bizzle slaps your account!

    BTW, your lens looks hella good man :-)

    Good luck!
    Vic
    {{ DiscussionBoard.errors[4451400].message }}
  • Profile picture of the author Kamikazee
    Thanks for that man. If I wanted it just to show up on my main homepage only, would I put it in after the <div class="entry"> line on the single.php?
    Signature

    {{ DiscussionBoard.errors[4451518].message }}
    • Profile picture of the author ExploringInfinity
      you can also use a plugin called 'whydoworkadsense' which has many customizable options for ways to display adsense or other ad types in your pages.

      Check it out if you want, that's what I use.
      Signature
      Get ALL the SEO software YOU CANT afford:
      Ultimate SEO Pack
      SENuke & Grscraper, and dozens more! $40 a month!
      {{ DiscussionBoard.errors[4451758].message }}
    • Profile picture of the author daweelmac
      Originally Posted by Kamikazee View Post

      Thanks for that man. If I wanted it just to show up on my main homepage only, would I put it in after the <div class="entry"> line on the single.php?
      I think single.php is for individual post/page and not for the homapage. Edit index.php instead.
      {{ DiscussionBoard.errors[4457052].message }}
  • Profile picture of the author leapharris
    Hi,
    For inject AdSense unit in the middle of post you need to open “functions.php” inside your theme folder. Now insert this code on on starting of file but after php start tag.

    function inject_ad_text_after_n_chars($content) {
    // only do this if post is longer than 1000 characters
    $enable_length = 2000;
    // insert after the first </p> after 500 characters
    $after_character = 1500;
    if (is_single() && strlen($content) > $enable_length) {
    $before_content = substr($content, 0, $after_character);
    $after_content = substr($content, $after_character);
    $after_content = explode(‘</p>’, $after_content);
    $text = ‘
    <!——AdSense Code here———->

    ‘;
    array_splice($after_content, 1, 0, $text);
    $after_content = implode(‘</p>’, $after_content);
    return $before_content . $after_content;
    }
    else {
    return $content;
    }
    }
    add_filter(‘the_content’, ‘inject_ad_text_after_n_chars’);



    In this code you can see one yellow point just replace it with your AdSense unit and save your file back in theme folder.
    Put AdSense in the Middle of Posts in Wordpress
    How to Add Adsense code middle of the wordpress post content | SEO Hyderabad
    {{ DiscussionBoard.errors[4451799].message }}
  • Profile picture of the author StoneWilson
    Nope, for homepage you need to add it into index.php instead. Actually there are lots of plugins can help you add Adsense ads in the posts if you are using Wordpress, you can find them on wp official website.
    Signature
    Looking for godaddy renewal coupon? Check GodaddyRenewal.com!
    {{ DiscussionBoard.errors[4451824].message }}
  • Profile picture of the author Super Warrior
    A simple adsense plugin should solve your problem. Did you try 'Why Do Work Adsense' plugin?
    Signature
    WARNING:: Wasting time on Facebook? Make $500 in just 24 Hours with this simple strategy!
    Get Free PDF (Direct download, no opt-in required)-->> Read It Now
    {{ DiscussionBoard.errors[4451952].message }}
    • Profile picture of the author Kamikazee
      Originally Posted by Super Warrior View Post

      A simple adsense plugin should solve your problem. Did you try 'Why Do Work Adsense' plugin?
      Yeah I've tried it and for some reason I cant get it to work. The only one that I could get to work was ad inject and when you refresh the page the adsense is no longer visible but the space is still there.

      The plug in is messed. I can place it once anywhere and have the ad show up, but as soon as the page is refreshed it goes blank. I'm trial and erroring some plugins right now. Its really frustrating.
      Signature

      {{ DiscussionBoard.errors[4455283].message }}
      • Profile picture of the author timpears
        For Wordpress I recommend using Whydowork plugin.

        You can put the ads in various positions and on only the pages you want them to appear on.
        Signature

        Tim Pears

        {{ DiscussionBoard.errors[4455437].message }}
      • Profile picture of the author imdomination
        Originally Posted by Kamikazee View Post

        Yeah I've tried it and for some reason I cant get it to work. The only one that I could get to work was ad inject and when you refresh the page the adsense is no longer visible but the space is still there.

        The plug in is messed. I can place it once anywhere and have the ad show up, but as soon as the page is refreshed it goes blank. I'm trial and erroring some plugins right now. Its really frustrating.
        Did you wait 15 minutes and then refresh your cache? It takes AdSense a while to set up a new ad, and then some themes won't show the ad up until you clear the cache. AdSense Integrator is my personal AdSense plugin of choice.

        Glad you got it sorted, anyway.
        {{ DiscussionBoard.errors[4456973].message }}
  • Profile picture of the author JoshuaG
    Man, these people are making things way more confusing for you then they need to be.

    Forget all the plug-ins and PHP file editing.

    If you want to display that ad unit only on your homepage do this:

    1 - Open the post/page in your wordpress editor.
    2 - Click the HTML tab above the content box (its on visual editor by default)
    3 - Use <div style="float:right">Adsense Code</div> as the first guy suggested.

    DONE.
    Signature

    {{ DiscussionBoard.errors[4455892].message }}
    • Profile picture of the author Kamikazee
      Originally Posted by JoshuaG View Post

      Man, these people are making things way more confusing for you then they need to be.

      Forget all the plug-ins and PHP file editing.

      If you want to display that ad unit only on your homepage do this:

      1 - Open the post/page in your wordpress editor.
      2 - Click the HTML tab above the content box (its on visual editor by default)
      3 - Use <div style="float:right">Adsense Code</div> as the first guy suggested.

      DONE.
      Josh Thank you a ton for clearing that up. I know the first person told me to do that but I was confused about where to insert the code. You are awesome!!!
      Signature

      {{ DiscussionBoard.errors[4456096].message }}
      • Profile picture of the author JoshuaG
        Originally Posted by Kamikazee View Post

        Josh Thank you a ton for clearing that up. I know the first person told me to do that but I was confused about where to insert the code. You are awesome!!!
        Ha ha thanks bro and np.
        If you need a hand with anything else let me know.
        Signature

        {{ DiscussionBoard.errors[4456564].message }}
  • Profile picture of the author Wixkaz
    This is really cool. I used the <div style="float:right">Adsense Code</div> to put an amazon affiliate banner ad into a post. I had to add a margin so that it didnt look so crowded: <div style="margin:10px; float:right">Amazon Code</div>
    Thanks for this very useful post and all the replies,

    Keith
    {{ DiscussionBoard.errors[4459277].message }}
  • Profile picture of the author simonbuzz
    Banned
    WordPress › Advertisement Management « WordPress Plugins with this plugin you can insert ads on almost any place you want...hope that helps
    {{ DiscussionBoard.errors[4459476].message }}

Trending Topics