WordPress hack, Filling wasted space

Got some posts running longer than others? Well you have a sidebar that is fixed length and when you have a 4000 word post you now have a lot of wasted white space on you blog. Here’s what we did in our SEO for WordPress tip of the day. With a little PHP you can count the words and apply ads accordingly to match the length. More words = more space = more ads = more revenue. A 1 minute SEO for WordPress idea that allows you more ad space instead of more wasted space.

Put this baby into your single .php file or index, depending on the template.
Whichever page shows your posts. Right after the the content of the template.

$content = strip_tags($content);

Now at the bottom of your sidebar or bars, use a simple php code like this one.
I use one for 1500 characters, then another for 2500 characters, and perhaps another for 3500.
This way the longer your post the more ads your sidebars will show.

And once placed they may never get triggered, but if they do by an oddly long post, I know I will have no empty sidebar or wasted ad space.

<-?php if (is_single()){ ?->
<-?-php- if ($length>2500){ ?->

put your ad banner here.

<-? }} ?->

Not exactly splitting the atom, but this keeps you from having all that blank white space in your sidebar when you have a long post. Just add this and forget it, your sidebars will place more ads the longer you post is.

Remove the ‘-’ hyphens from the php tags above of course.

About author

Todd Kron

of Sellaholics is a veteran of Analytics, PPC, Display, video, UX, conversion optimization, affiliate programs, web design and web programming since 2002. My background includes affiliate sales to 6 figures, director of a web design agency, and currently the digital manager for a leading energy company located in Huntersville, NC. From search to sale 1000 different ways is my background. Sellaholics is a Google Partner Agency.