• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

WP SITES

2662

Original Genesis Tutorials & 5000+ Guaranteed Code

Snippets

  • Support
  • Newsletter
  • Videos
  • Log in

Premium Member? - Request custom code

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.

Register for full access

Reader Interactions

Leave a Reply Cancel reply

You must be logged in to post a comment.

Primary Sidebar

PHP Code

template_include

get_body_class

if else

array

class_exists

foreach

sprintf

add_action

printf

variable

Advertise · WPEngine · Genesis · Log in

  • How Premium Membership Works
  • Sign Up
  • Support
  • Subscription Details/Invoice
  • Tagged Tutorials
  • Access-Download Problems