How to fix ads being inserted inside the table of contents – Ads inserter & Table of contents plugin

Is your ad being displayed inside the table of contents and making your content look not right?

Here, I have a quick solution to fix this issue which can be caused when you are using ads inserter plugin to insert ads and Easy table of contents plugin to generate an automatic table of contents for your WordPress website.

an example

I have noticed this to happen mostly when your post content is small or can happen anytime as well.

Let us take an example from one of the posts on this website,

ads inside table of contents plugin and ads inserter plugin

In the above screenshot, you can see an ad (yes a demo ad) is being inserted inside the table of contents by the Ads Inserter plugin.

While the contents have been published correctly as they should have been, but the placement doesn’t seem not quite right.

the reason for ads being inserted inside table of contents

The plugin we are using Ads inserter to insert advertisements into our WordPress website is doing the right job as it is expected to do. Likewise, the Table of contents plugin is also generating the table of content exactly as it is defined to do.

But the ads inserter thinks that table of contents is also a normal content, a paragraph let us say. We need to tell this plugin that it is wiser to skip the table of contents to insert ads in our case.

Your Gift of $200 Cloud Hosting Credit is Here. Claim Now!

the solution

And the Ads Inserter has this advanced feature available for free just for this reason! We can define where exactly we want our ads to appear and where not.

So if you want to solve this issue, here’s the easy way to solve this:

  • open the ads inserter plugin’s page from your dashboard, Settings -> Ads Inserter
  • click and open the Settings tab as shown in the following picture
  • from the general tab, scroll down until you find – No paragraph counting inside
  • add ul and div in this field,
    this is what it looks like after I’ve added the new values
blockquote, figure, li, ul, div

Now, save the settings and you are done. Open up or refresh any post that ads inserted inside the table of contents to discover being displayed correctly.

Did this method work for you?

Let me know in the comment section below. 🙂

Before you go, let's stay connected
About the Author
Lakshman Basnet
Nepali Digital Media Marketer currently based in Adelaide, South Australia who apart from playing with his cat - Eleven, also enjoys developing web content, publishing blogs and YouTube videos in his free time.

Leave a Comment