If you want to hide Ads from the regular readers who visit your blog on a daily basis to read the fresh content, you can apply this trick to show ads only on older posts which are some specific days old. (older posts are mainly viewed by search engine and referral visitors.)

Here is the procedure to display ads only on posts which are 3 days old.

Goto Dashboard->Appearance->Editor->Single.php

Note: Do make proper Backup of the Single.php file of your blog’s theme before committing any changes.

Enclose the Adsense code inside the code below. And change the value ‘3‘ to any number so that the ad get displayed on only the posts which are older than the specified number.

Note: This code will only work in Single.php don’t use it anywhere else.


<?php
if (strcmp( date("Y-m-d", strtotime("-3 day")), get_the_time("Y-m-d") ) > 0) {
?>

INSERT YOUR AD CODE HERE

<?php
}
?>

However, I display Ads on newer posts because sometimes visitors get some useful relevant links in the Ads, which may prove helpful to them.
[Via]