How to Show Ads based On Content Length?
Interesting and Important to user who used Adsense PPC as a Publisher.
Problem:
- Sometimes visitor are getting bored if they read our content that fully show Ads Unit.
- It’s wise if our blog content relative short in character length.
- Currently displaying two blocks of ads on each blog post, one at the top of post, the other at the end of post.
Solving:
- This code only work only on wordpress support.
Referring from LiewCF Blog Show Ads Based on Content Length
< ?php
$countpost = $post->post_content;
$countpost = preg_replace(’/\s+/’, ‘ ‘, strip_tags($countpost)); // remove white space and html
$words = ((count(explode(” “,$countpost)) + count(explode(”.\r”,$countpost)))-1); // count spaces and periods
if ($words> 100) {
?>
< ?php } ?>
No Comments
No comments yet.
RSS feed for comments on this post. TrackBack URI
Leave a comment
You must be logged in to post a comment.



