How to Display/Insert Adsense Ads inside WordPress Posts?

If you’re an Adsense publisher, you might’ve known the importance of CPC (cost per click) and CTR (click through rate). One should improve the performance of CPC and CTR if he wants to earn high from Google Adsense. Generally, webmasters try to place the advertisements at the beginning of the article (under the title) to get more clicks. But, this tactic won’t work in all the cases. Placing ads inside the article also has the highest click rate and so if you could insert your Adsense ads within your WordPress post, then CTR will eventually increase as there will be more chances for getting content-related ads.

Also see: Try to make use of the Responsive Adsense ads for better earnings.

Manually Display Adsense Ads Anywhere inside your WordPress Posts

This is very simple. By creating a shortcode in the functions.php file, you can achieve this.

  1. Login to your WordPress dashboard > go to Appearance > Editor.
  2. Click on the “functions.php” file from the right side panel.
  3. Copy and paste the following code in your functions.php file at the end.

    function adsense1() {
    return ‘
    <!– Start Here –>
    Paste Your Adsense Code Here
    <!– End Here –>
    ‘;
    }
    add_shortcode(‘adsense’, ‘adsense1′);

  4. Replace the lines in red color with your Google Adsense ad script that you wish to appear inside your WordPress post and click save.
  5. Starting now, whenever you compose a new post, simply go to “HTML mode” in the editor and type [adsense] at the point where you wish to display this Adsense ad and click “Publish”.Adsense Ads inside WordPress Posts
  6. You can even add styles to your displayed advertisement.
    • Go to Appearance > Editor and open style.css file.
    • Add the following code at the end and click save.

      .adstyle {
      background:#f4f4f4;
      width:400px;
      height:500px;
      text-align:right;
      float:right;
      border:solid 1px #c7c7c7;
      }

    • This is a sample code and you can modify it as per your blog colors.

Note: If you’re adding style to your ads, then don’t forget to use <div class=”adstyle”>[adsense]</div> instead of [adsense] in the step 5.

This is a handy shortcode method to insert advertisements or banners within your post content. Not just Adsense ads, you can follow this guide to add any code inside your posts.

Note: Although, there are plugins to add Adsense ads inside WordPress posts, I personally prefer adding them manually as plugins will increase the load time of our blog.

Incoming search terms:

  • how to place ads inside posts manually
Last Updated on by Radha Krishna under Wordpress Category 3 Comments

Tags:

 

Share This Article

Get Free Email Alerts

Stay Updated with Useful Blogging Tips. Get Free Email Newsletter Updates..

And, Next Confirm Your Email Subcription

   

3 Comments to “How to Display/Insert Adsense Ads inside WordPress Posts?”

  1. Narender says:

    You said right Radha Bro Plugins are good to use but makes your blog slow.But your Tut is so easy that I don’t think one will use any plugin for that purpose :)
    Narender recently posted..Should You Make Blogging Your Career ?My Profile

  2. Dencia says:

    I actually use plugin. It saves time though it might slow your website down but it is hardly noticeable.
    Dencia recently posted..Unilever Nigeria Plc VacanciesMy Profile

  3. Good Post, Thanks for It!

Leave your comment here:

CommentLuv badge
 
We Use & Recommend
[Bluehost - Review | Installation | Discount ] Bluehost Coupon
Free Email Alerts
Facebook Twitter Google Plus RSS Feed Email
Rate Us

Like US