Google’s Adsense Ads are a great way to earn money from your site’s traffic. Just add this WordPress Code Snippet to the functions.php file in your current WordPress theme in order to add an Adsense Ad after every post in a site running on the StudioPress Genesis Framework.
/** * Add Adsense Ad after posts in StudioPress Genesis * * @author WPSnacks.com * @link https://www.wpsnacks.com */ function ad_after_posts() { if ( is_single() ) { ?> <strong>Sponsored Links</strong> <br> <script type="text/javascript"><!-- google_ad_client = "ca-pub-5636129889821632"; /* WPSnacks_After_Post_Ad */ google_ad_slot = "2107218414"; google_ad_width = 468; google_ad_height = 60; //--> </script> <script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"> </script> <?php } } add_action('genesis_after_post_content', 'ad_after_posts');
Just be sure to replace my Adsense Ad code(between the first and last “script” tags) above with your own. In the example above, the section is headed with “Sponsored Links”, which can be changed to what you would like the heading text above your Ad, just be sure you follow Google’s Adsense Guidelines.
share market says
The more simpler way will be to use some plugin. Post layout plugin does the task easy, and it has many more features.
Emily Murray says
This is great thanks! Is there any way to exclude specific categories or posts that you do not want ads displayed on?