WordPress – Showing Ads only on Old Posts
Thanks to Viper007Bond for, quite literally, showing me how to do this!
Advertising on old Pages and Posts
If you want to show ads to readers on posts or pages that are of a certain age, just place the code below in either your single.php or page.php file.
You can use your judgement as to where you want the ad and what size it will be. Remember, change the amount of days, I have it set to 30 in this code.
<?php
if ( get_the_time('U') < strtotime('-30 days') ) {
// show ads
}
?>WordPress Plugin
I am thinking of adding as a feature to my Advanced Adsense Plugin for WordPress or maybe I will just create a seperate one.
Photo Source: http://www.flickr.com/photos/dan4th/ / CC BY 2.0
Related Posts
- Visio Online by Gliffy
- WordPress - Showing Ads only on Old Posts
- Search Engine Guidelines | SEO Tuesday
- Google Requires a Privacy Policy for AdSense Publishers
- Everyone loves these, you will too.


i feel retarded. i couldn’t find your ‘blog” so i clicked on the keywords in your tag cloud until i found a relatively recent post. i’ve been sick all week; it’s my inability to concentrate. sigh. don’t ask me what i am doing. i’m still figuering it out.
i’m glad that united states currency doesn’t allow corporate sponsorship. can you imagine ronald mcdonald on the dollar bill? or microsoft on the hundred dollar bill? don’t shake your head, you *know* it’s going to happen one of these days.
how much does that big-screen television cost?
it’s two-thousand five hundred ciscos, but we’ll discount it by an apple if you hook it up to their iNetwork and subscribe to their iPay service. and if you buy it today, you’ll beĀ eligible forĀ a mint bill gates coin rebate.
Hola Sera!
You are still sick, sorry to hear that. I read one of your posts when you started feeling sick. You ask me not to ask you what your doing, knowing that’s exactly what I want to ask you, brilliant. :~D
You put Cisco on the dollar bill, I wonder what they would think about that. We have to have Starbucks in there somewhere…
I hope you get better soon,
That’s a neat little trick but I’m a little confused on how this works.
I don’t see anything referring to ads in the code, just the time.
you mentioned putting adsense in my blog to generate some money after i’m gone from my job. but i don’t think people really make much money from those ads, do they? i don’t want to be one of those blogs that has blinking ads and moving banners everywhere. i know every dollar helps, but i need more than coffee money.
Sera,
It depends on how much traffic you get. I see that you get a lot of comments. If you put one ad ( and I only put the ads on old posts, that way my subscribers don’t see ads and mostly just search engine visitors will) just before the comments, you may just make a little income. Again, it has to do with your traffic. On one blog I made a couple hundred dollars in a month, but some people make much more. I just see it as extra money…
You are right though, I don’t like sites with a lot of ads, so if you do put one up just make it a nice spot.. You will be amazed at how many people actually click advertisements..