DigitCodes

Coding Notes


Follow @afsalrahim
  • PHP Codes
  • Web Design
    • CSS Tricks
  • WordPress
    • WordPress Tips
    • WordPress Themes
    • WordPress Plugins
  • Blogging
You are here: Home / Wordpress / Wordpress Codes / How to Easily Show Adsense Ads anywhere Inside the Blog Post

How to Easily Show Adsense Ads anywhere Inside the Blog Post

December 26, 2012 by Afsal Rahim 16 Comments

How to easily show Adsense Ads anywhere inside Blog Post

[adslot]

Proper placing of your ads is a really effective way to maximize the Google Adsense earnings. And many people supports and recommend to place ads inside or within the blog post. In this article I’m going to share to you how I easily show Adsense Ads anywhere inside the blog post by creating shortcode in WordPress.

I have created a shortcode [showads468×60] in my functions.php file which allows me to use that shortcode inside any blog post I make at any place. Wherever I place the shortcode [showads468×60] it will automatically show up the corresponding ad I have created for the same. Sounds cool..nah?

show ads inside blog post

Ok then, lets get started. First of all you will have to create the shortcode and for that goto your edit your functions.php (Appearance>>Editor>>Theme Functions(functions.php)) and put the below code at the end of it. (* Keep a copy of your functions.php file before doing it, just in case 😉 )

Make sure you replace the term [YOUR ADSENSE AD CODE HERE] with the adcode you get from creating the ad in your adsense account. So finally you will have code like this:

That’s it..! Now you can use the shortcode [showads468×60] anywhere in your blog post and it will show up the adsense ad there. You can also further create separate short codes for each ad size like [showads320x240] or [showads250x250] in the similar way by replacing the shortcode tag name and adsense adcode. Hope you like it 🙂

Filed Under: Wordpress Codes Tagged With: WordPress Tips & Tricks

Comments

  1. Dawah says

    January 29, 2013 at 3:51 pm

    Wao, dis is really helpful

    Reply
    • Afsal Rahim says

      January 29, 2013 at 7:31 pm

      @Dawah It will also help you increase your earnings from Adsense when you place the ads at the right place. 🙂

      Reply
  2. Nikhil says

    February 14, 2013 at 9:12 am

    Now its easy to add ad unit in post. Thank you it very helpful to newbie bloggers.

    Reply
  3. Umesh Tarsariya says

    March 5, 2013 at 5:54 pm

    Hi Afsal Rahim,
    I am used to blogger platform, I like this feature of a WordPress which blogger not provides. I am sure blogger will also going to introduce same feature.
    Regards,
    Umesh Tarsariya

    Reply
    • Afsal Rahim says

      March 9, 2013 at 9:04 pm

      Thanks. Yeah.. WordPress lets us do a lot of customization unlike Blogger platform and thats why I just love to work with WordPress platform. 🙂

      Reply
  4. Rahn says

    January 6, 2014 at 7:53 am

    Good idea, and so simple to implement I’m surprised I haven’t seen this all over the place.
    I like the idea of implementing different codes for different size ads. And heck, supposed it wouldn’t be hard to also wrap the ad code in some style too.

    Reply
  5. shafique says

    March 5, 2014 at 8:42 pm

    Adsense is good thing to monetize blog but showing too much ads will annoy visitors as well decrease CTR which will affect earnings so my opinion is keep ad codes on selected page where user may click your ads.

    Thanks for sharing

    Reply
  6. Lorna says

    May 1, 2014 at 6:52 pm

    Leaving a comment to express my gratitude for this, thank you so much!

    Reply
  7. wasim says

    May 19, 2014 at 8:59 pm

    This is nice trick but it is possible in blogger using java script function or anything like that. ?

    Reply
  8. Naeem Malik says

    November 7, 2014 at 10:06 pm

    This is great tool! Though it is bit cheesy for someone who does not know much of coding and all.

    Reply
  9. Rajat says

    December 8, 2014 at 10:16 am

    Hello sir how i can automatically show adsense ads within my posts automatically using this way on my site idmtechsolutions.com

    Reply
  10. kalpana says

    January 14, 2015 at 12:48 pm

    Really awesome info thanks for this amazing Post 🙂

    Reply
  11. Leonardo says

    January 19, 2015 at 10:53 pm

    i need to show ads on my blogger site

    Reply
  12. Mik says

    June 1, 2015 at 7:03 am

    Hi, is there a way to do this automatically, by changing the template and not every post? 🙂

    Reply
  13. FullApkZ says

    October 3, 2017 at 3:20 pm

    How to get adsense shortcode in Blogspot dude?

    Reply
  14. AdSense help says

    June 25, 2019 at 12:48 pm

    Please how can I get thus for blogspot also

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Sponsered

FREE Email Updates

Subscribe to our newsletter to get all the latest updates to your inbox..!



TRENDING

How to Add Your Custom Logo to WordPress Login Screen?

Free HTML5 Responsive WordPress Theme : SimpleCorp

The Making of DigitCodes: Ideas & Codes + WordPress

The Easy Way to Show Placeholder images or Dummy images

Return to top of page

Copyright © 2016 · digitcodes.com · Privacy Policy · Contact Us