A friend of mine on a forum was curious on how to make the in-text popup advertisements only show up on older posts. Kontera, among others, supply those advertisements that are special links that show a content box when you hover over them. He found it too intrusive for his everyday readers, and so only wanted to show it on posts older than a week.
I had a script handy which I showed him, and it worked out fine. I am not saying this is the best script and everyone should use it, but it is my solution. If you have a better one, as always, I’d love to see it.
[php]
= 7) {
$older=1;
}
if ( is_single() && $older==1 ){ ?>
[/php]
Basically the script says, look at today’s date. Look at the post we are on and its date, and if it has been more than seven days, show the advertisement JavaScript.
You could use this code for all sorts of things. I have used it to show larger advertisements on older posts, as well as part of a script that shows advertisements only to those that are from search engines. It can be very useful to be able to manipulate WordPress in these ways.
Let me know what you think, especially if I have messed up. And I hope this helps those of you that have been wondering how to do this with WordPress and without any sort of plugin.