WP SITES

3082 Coded Tutorials & 285 Plugins

Add Widget After Post In Loop

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.

after-1st-post

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.

4 responses to “Add Widget After Post In Loop”

  1. Display Ads After Specific Paragraph on Single Posts

    […] Add New Widget After 1st Post On Home Page […]

  2. Add Unique Widgets After Archive Excerpts in Genesis

    […] Add Widget After Post Excerpt on Archive […]

  3. Add Content After Any Number of Post Excerpts In Any Type Of Archive

    […] Add Widget After First Post In Archive Loop […]

  4. Add Banner After Any Number of Posts On Any Archive Page In Twenty Fifteen

    […] Add New Widget After Post In Home Page Loop […]

Leave a Reply

New Plugins