This new fabulous feature of Header and Footer has been requested few times and I introduced it for a my personal need on a big blog I manage.

How does it work?

Rather simple: a generic block of code (in my case a snippet of JavaScript) had to be included just before the first <h2> subtitle in posts but only if the <h2> subtitle was “enough” far away from the post main title.

It is not easy to control all that in a scientific was, but we are not scientists, we need only to put an ad in the middle of a post.

So the natural rule were: add this piece of cool code just before the first <h2> you find but start searching for it after 700 characters from the start of the post. You know a post contains HTML tag so 700 characters and actually not 700 human readable characters, but still we are no scientists.

This rule is so clear that it toke to me few minutes to implement (of course using the code already written in that big blog in a custom plugin…).

Another interesting way to find an injection point is the <p> tag, or the closing </p> tag. For example you may want to add something just after the first post paragraph. The rule will be: add that just after the first </p>, of course starting to search from the top of the article.

Why to inject before or after an HTML tag? Rather simple, because you don’t want to break up your so carefully written article, right?

There are special case on may want to manage: what if the <h2>tag is not found on a specific article? Maybe we want to recycle that code and inject it at least on top or bottom of the article (you know, loose ad impressions is not good). The rule has an option for that as well.

Now it’s up to you: add your own rules and inject the ads in the most profitable position and… share with me your results!

Similar Posts

3 Comments

  1. You guys didn’t explain much about the “INNER POST INJECTION 1”. How can someone make use of it to add maybe Adsense inside post or something? What are those “maker, skipping, charset and others. I will appreciate if explained, Thank you very much.

    1. The marker are html tags to be found in the post as points of injection. See the article, but you need to know the tags produced by WP to use this feature. Otherwise I can suggest to look for ads injection plugins which are less technical to use and provide injection rules like “after the 2nd paragraph”.

  2. Hello! I would like to know if I can enter a shortcode different but occur only in Desktop “After the tag.” I’m using “advanced ads Plugin” and we did a group of ads and I’d like to see only the desktop, not in the phones. I have opportunity to introduce aces and group code php “”

Leave a Reply