Ads are part of our life on Internet nowadays and many webmasters use them to make money.
It became common, for me at least, to land on a page 'littered' with ads, and I instinctively bounce off although the content might have been good.
I already posted my opinion on why you should keep your homepage ad-free and here is another tip for how to keep your articles appear ad-free to new visitors.
If you decide to show ads (context, in-text and other) only on articles that are older than xx days (xx being anything from 2 to 5 days) your revenue change only slightly, but you will gain a positive effect on all of the below:
- Bounce rate
- RSS subscribers
- Any social media promotion
- Overall credibility of the site
Let's see how can you do that easily if you use WordPress.
Here is a short code you can place in your functions.php file.
function new_post($days = 5) { global $post; if(is_single() || is_page()) { $expire = time() - $days*24*60*60; if (mysql2date("U", $post->post_date) > $expire) { $return = true; }else{ $return = false; } }else{ $return = false; } return $return; }
Now, whenever you add ads, you can perform this check:
<?php if (!new_post(3)) : ?> <!-- your ad code goes here --> <?php endif; ?>
And voila! The ads will appear only on posts that are older than 3 days.
Suggested reading:
- Simple WordPress thumbnail function
- WordPress shortcode snippet to display external files
- Tweaking WordPress: How to create a floating paragraph before your post
Posted in: Startups, WordPress
TAGS:ads posts older, check post older wordpress, is_older wordpress, older days php, php older day, php page older days, wordpress articles old days, wordpress check post older, wordpress don display older, wordpress post older days, wordpress published before days, wordpress twitter older days






One Comment
I love this simple code, but as you can modify to tell if you have less than 3 days show this one.
No programming, could you clarify me. thanks