Try this code (enable PHP processing – top right button):
<?php
$ads_since_date = '2018-01-06';
if (get_the_date ('Y-m-d') < $ads_since_date) :?>
AD CODE
<?php endif; ?>
Set $ads_since_date to a date from when the ads should be inserted.
Of course, this code will work only inside posts and static pages.
Hi Igor
Thanks for the code! I’ve not had a chance to implement it before now.
It’s not working though – the ads are appearing irrespective of post date being before or after the $ads_since_date string (which I have kept the same). I’ve also had increased ‘webpage encountered a problem and reloaded errors’ since I implemented the code. I’ve turned it off for now.
I have automatic insertion set to ‘after content’, and ticked Posts, with no modifier.
My bad – didn’t follow the instruction to enable php processing.
After that it worked, with a small adjustment – get_the_date > $ads_since_date
Great!
Of course, ads need to be excluded for old posts.
I would appreciate if you could write a short review:
https://wordpress.org/support/plugin/ad-inserter/reviews/
Thank you,
Igor