This code enables you to add a new widget area after the 1st post on the home page archive.
This is a popular spot to add Adsense code and affiliate advertising banners as it displays in the same position after new posts are published.
Adsense code also works great in text widgets and its better to add HTML in a widget rather than hard code it into a custom file or template file.
The code is easy to customise so you can use on any other type of archive simply by changing the conditional tag.
If you want to add the widget after the 2nd or 3rd post, you can, simply by modifying a single number in the code. Its as easy as that.
Here’s the PHP code you simply copy and paste into your child theme functions file.
Leave a Reply
You must be logged in to post a comment.