Adding Google Adsense Code in Genesis theme is very easy by using Simple Hook Plugin. Using this plugin one can insert adsense almost anywhere e.g. before or after of header, footer, post title, post content, post info, comment-box, sidebar etc.
But what if you wish to add adsense in home page in between posts, for example, after each second post or third post. Simple hook plugin can not solve this.
You need to create a widget area by editing your theme’s functions.php
Add the following code inside functions.php
You need to also add the following code in style.css for styling purpose
.wbxp-google-ads { text-align: center; margin-top: 20px; margin-bottom: 20px; }
Now you should see a widget in your theme Appearance->Widgets
Add a Text Box in this widget and paste your Google Adsense code inside it. Now you should see adsense displayed in your home page after each second post. If you wish to add adsense after each third post, just change the value to 3
$loop_counter == 3
Leave a Reply