How to embed ads in the comment section

When monetizing a website, an area where users can actively engage with each other can be a valuable asset. Websites that foster lively discussions among users, such as news websites and blogs, can offer a lot of potential for capturing readers’ attention and generating revenue through ads.

This tutorial will show you how to use Advanced Ads to insert ads into the comments section of your website. By doing so, you’ll be able to monetize the interactions and engagement of your users more effectively, helping you to earn more money from your website.

Monetize the comment area

On a classic WordPress website, the comment function is available for posts but not for pages. The whole section follows at the end of the content of your articles.

There are three prominent places to integrate ads into the comments section:

  • immediately above or below the comment form
  • between comments
  • above or below the top comments

So let’s work on adding some ads to this section and monetizing this user-generated content.

Ads between comments in WordPress

Enjoy our short tutorial video or follow the step-by-step guide below.

How to place single ads between comments

The Custom Position placement is the most flexible tool to place ads between comments or in the comments section. This placement is a feature of Advanced Ads Pro. It allows inserting ads before or after definable elements.

First, you create a new Custom Position Placement for this task and assign the ad you want to include in the comments section.

Then, define where precisely Advanced Ads should embed the placement. 

You can manually specify a selector for this or use the placement’s position picker and click on the desired position in the frontend.

This video shows how to use the Custom Position placement.

Specify the selector for the Custom Position placement

If you want to enter the selector manually, load a post with comments in the frontend and open your browser’s developer tools. Now, you can determine the class that your theme sets for comments. The class differs between different themes.

Once you have determined the selector you want, paste it into the field highlighted in the screenshot below.

Custom Position placment settings to embed ads between comments
Paste the selector into the placement options

For the WordPress default theme TwentyTwenty-Three, the selector to place an ad below the top comment is e.g. ol.wp-block-comment-template > li.comment.even:eq(0).

In contrast, the selector to insert the placement at this point in the popular Divi theme looks like this: ol.commentlist.clearfix > li.comment.even:eq(1) > article.comment-body.clearfix.

Use the Custom Position placement frontend picker

However, using the frontend picker is much more convenient than tracking down the selector with the browser tools.

To run this helpful tool, click on the “select position” button, which you can find in the settings of each Custom Position placement. Then, Advanced Ads will redirect you to your website’s home page.

Now, navigate from there to a post with comments, or paste the URL of such a post into the address bar of your browser. Open the post, and scroll down to the comments section. Now you can precisely select where you want to insert this placement.

Custom Position placement fronend picker

After marking a position, you will automatically return to the placement page. Here you can edit and save the selected position if necessary.

Finally, navigate to the frontend and check if your ad appears as desired between the comments.

How to place multiple ads between comments

If the posts on your page have many comments, inserting multiple ad spots could be profitable. To achieve this, you can follow two strategies.

On the one hand, you can repeat the steps described above and create additional Custom Position placements. In this way, for example, you could insert an ad after the 1st comment, another one after the 4th comment, and a third ad after the 8th comment.

On the other hand, depending on the technical conditions of your comment section, you could also try to find repeating selectors so that a specific placement is automatically inserted multiple times. One use case could be, e.g., to have an ad appear under the last comment in each instance of a specific nesting. This setting is very individual and theme-dependent, so I can’t suggest a generally valid selector here.

Compatibility with third-party tools for the comment section

Some plugins and services extend, customize, or replace the standard commenting features of WordPress. You can also inject advertisements in or around such comment sections.

Comments – wpDiscuz

The free plugin Comments – wpDiscuz is a comprehensive collection of tools to enhance the comments section of your website and make it more attractive. The plugin also offers a dedicated paid add-on to insert ads between comments. 

However, Custom Position placement works fine in this setup. Therefore, you can insert your ads with Advanced Ads and benefit from the plugin’s numerous features.

I recommend the procedure described above to embed ads into comments managed with wpDiscuz. Use the browser tools or the frontend picker to set the desired position for the Custom Position placement and save your setting.

For example, to place an ad under a nested comment, you can use this selector: div#wpd-threads > div.wpd-thread-list > div.comment.even:eq(0).

Ads between comments managed by wpDiscuz


Another popular comment management service is Disqus. With the help of a dedicated plugin, Disqus stores the comments outside of WordPress and then reintegrates them from that location. Therefore, including ads between each comment is technically impossible in this configuration.

However, a recommended ad position on websites that manage their comments section with Disqus is to place banners directly above the Disqus element. This way, you can ensure the visibility of your advertisements for all users participating in the discussion. 

Advertisement above the Disqus form

You can also hook into this position using the Custom Position placement. An alternative, yet more complicated method would be a manual placement that you insert directly into your theme using a PHP function.

Subscribe to our newsletter and get 2 add-ons for free!

* indicates required


You’ll be lucky if website visitors discuss your articles and return regularly. Because where there is interaction, there is attention. And you can also vie for your users’ engagement with cleverly placed ads to increase your website’s revenue.

Advanced Ads Pro’s Custom Position placement is the perfect tool to embed ads comfortably in the comments section without having to code and test this potential.

Make it better

Increase your ad management skills without spending more time.
Join over 150,000 publishers and AdOpts increasing their ad revenue.