Top 10 WordPress Hacks

WordPress is already a powerful enough engine, but the hacks that we will show you today will allow you to unleash every bit of power that is still somehow trapped in this great blogging engine. Here is a list of the 10 top hacks for WordPress that we have chosen for you.

No 10. Displaying Adsense Ads to search engine visitors only

Using this code, you can, as the name suggests, have the flexibility of displaying Adsense Ads to those who come from the search engine itself. You might not be aware of the fact that regular visitors don’t click on Ads, but the ones coming from the search engines do, so this code will help you optimize your blog by adding this little trick to your arsenal.

function scratch99_fromasearchengine(){


$SE = array(‘/search?’, ‘’, ‘’, ‘search.’, ‘’, ‘’, ‘/search/’, ‘.yahoo.’);

foreach ($SE as $source) {

if (strpos($ref,$source)!==false) return true;


return false;


Use the above code in functions.php and then paste the following code in the template where you want the Ads to appear:

if (function_exists(‘scratch99_fromasearchengine’)) {

if (scratch99_fromasearchengine()) {




No 9. Displaying Gravatars in comments

This code will allow you to display Gravatars in the comments for your blog. Open up comments.php and first find the following line of code:

<?php comment_text() ?>

Then replace this code with the following:

<div class=”gravs”>
<?php if (get_bloginfo(‘version’)>=2.5)
echo get_avatar( $comment->comment_author_email, $size = ’50’, $comment->comment_author_link);?>
<?php comment_text() ?>
<br clear=”all” />

Now, use the following in style.css for CSS:

.gravs {margin-top:20px;}
.avatar {float:left; margin-right:5px; margin-bottom:5px; padding:3px; border:1px solid #999999;}

Related posts

Top 10 iPhone Apps by Sales Volume


Windows 8 Incoming Features


Redsn0w 0.9.8 beta 2 available for iOS 5 Tethered Jailbreak on iOS devices