While inserting ads in the post content is fairly easy, to insert ads between posts on your homepage, category pages or other archives is a bit more complicated. Advanced Ads has a couple of options to do that manually or automatically. This tutorial shows the simplest solutions our ad plugin for WordPress can current provide.

  1. AdSense In-feed between posts
  2. using a PHP function
  3. with the Post Lists placement
  4. with the Custom Positions placement

Please find the explanation of each method below.

AdSense In-feed between posts

If you want to place the AdSense In-feed ad between posts on your WordPress site then place check out this dedicated tutorial.

Insert ads between posts manually in your template

With the basic version of Advanced Ads, you can create a Manual Placement and put it into the loop in template files like home.php or index.php. The function to go with is the_ad_placement(‘your-placement-id’) .

If you want to show the ad only between specific posts (e.g. the fourth and the fifth), you can use the code from below.

// global $wp_query; // uncomment if loop content is in another file or function
if( function_exists('the_ad_placement') && $wp_query->current_post === 4 ){ 

your-placement-id is the id of the placement you created. You get this by clicking on the Usage link in the placement table.

Please make sure that you have access to your files via FTP and make a backup of the edited file, because a simple PHP error could break your site.

If coding is not your strength then insert ads between posts with the Post Lists placement, which is explained below.

Inserting ads betwen posts automatically (most simple solution)

The most simple solution is to use the Post Lists placement. This is a placement we developed specifically to insert ads between posts. It works similar to the normal content injection.

The Post Lists placement comes with Advanced Ads Pro and can be found under Advanced Ads > Placements. A simple setup might look like this:

Post Lists placement setup


This placement is using WordPress standards. You can find more details about it on this page.

If your post list is not based on the default loop or has some specific design then take a look at the Custom Position option below.

You're using WordPress and would like to get Advanced Ads for free?

Using Custom Positions for advanced layouts

Some themes have specific layouts for all or some archive pages. This might be a grid on the homepage or an implementation of the post list that is not based on WordPress standards.

In these situations, the Custom Positions placement might work better than Post Lists to insert ads between posts.

The Custom Position is a placement that allows you to select any position for an ad. Hence, you can also choose a position between posts on your homepage or other archive pages.

The example below shows the Custom Position settings after choosing the fourth element in a post list in the frontend.

insert ads between posts in WordPress

Inserting the ad between posts with this placement might need some custom adjustments to your layout, especially, if this is a grid with a specific number of elements. Ask your frontend developer or the theme developers for help.