Back WordPress

How to put Adsense Ads within the Content of a WordPress Blog

WRITTEN BY ON 19 Aug 2012
11,070 VIEWS • SHARES
0 comments

You cannot easily put your adsense codes inside the content of a post in your WordPress Blogs. This snippet will make a shortcode available to you. All you need to do is to paste that shortcode in write post area to include your Adsense ad.

PHP

Make an adsense shortcode and put your ads anywhere inside the content easily. Out the below code in functions.php and use [ads1] shortcode in your Post to get your ad placed there. Details in the source link.

 function the_adsense($atts) {
 return ' <div class="post-link-ad"> Put Your Adsense Code Here </div>'; } add_shortcode('ads1', 'the_adsense'); 
Join the discussion

Comments will be moderated and rel="nofollow" will be added to all links. You can wrap your coding with [code][/code] to make use of built-in syntax highlighter.