How to Add Avatar to Your Comments

The default wordpress themes are came with avatar support. In case you have use some other free or premium wordpress themes with no avatar support, then you can adding the following simple and short coding to your comment.

<?php echo get_avatar( get_the_author_email(), '80'); ?>

get_the_author_email outputs the post author’s email and the “80” is the size of the avatar image in pixels, you can change the size of the avatar according to your needs. Is it looks simple? @@

My Page Order – Allows You Arrange The Order of Your Static Pages

You can set the order of the pages for wordpress, the order of the pages are sorted by ascending. If you want to control the order of how things are displayed for pages, you can use My Page Order wordpress plugin. How does it work? This plugin gives you a simple interface that allows you to arrange the order of your static pages. It uses and sets the same field in the database as WP does so if you have set an order before it will be preserved.

How to Display Post Words Count

I don’t know why some people like to display post words count on their blog, but I personally don’t like this function. In case you are the ones like this function, then you can copy and paste the following coding to functions.php.

function wcount(){
ob_start();
the_content();
$content = ob_get_clean();
return sizeof(explode(" ", $content));
}

And then you can call the function to get the number of words of the current post:

<?php echo wcount(); ?>

Thanks to Digging Into WordPress for this excellent code.

How to Display Recent Comments Without a WordPress Plugin

Get Recent Comment wordpress plugin shows excerpts of the latest comments, it also can (optionally) separate the trackbacks/pingbacks from the comments.

If you don’t want to use any wordpress plugin to display recent comments, you can copy the following coding and paste it to the sidebar.php file. To change the number of displayed comments, simply change the LIMIT “10″ to your desired number.

<?php
global $wpdb;
$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID,
comment_post_ID, comment_author, comment_date_gmt, comment_approved,
comment_type,comment_author_url,
SUBSTRING(comment_content,1,30) AS com_excerpt
FROM $wpdb->comments
LEFT OUTER JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID =
$wpdb->posts.ID)
WHERE comment_approved = '1' AND comment_type = '' AND
post_password = ''
ORDER BY comment_date_gmt DESC
LIMIT 10";
$comments = $wpdb->get_results($sql);
$output = $pre_HTML;
$output .= "\n<ul>";
foreach ($comments as $comment) {
$output .= "\n<li>".strip_tags($comment->comment_author)
.":" . "<a href=\"" . get_permalink($comment->ID) .
"#comment-" . $comment->comment_ID . "\" title=\"on " .
$comment->post_title . "\">" . strip_tags($comment->com_excerpt)
."</a></li>";
}
$output .= "\n</ul>";
$output .= $post_HTML;
echo $output;?>

Thanks to WPHacks for this awesome coding.

Hotlink Protection – Protect Your Images Being Hotlink in Other Places

No people like their images of their blogs being hotlink in other places, because this will increase your bandwidth usage and slow down the speed of your blog. In order to avoid your images being hotlink by other people, you can use Hotlink Protection wordpress plugin to protect it.

How It Works

  • Referrer check if someone requests an image from your blog. If the referrer is not empty and not your blog the request is redirected to an information image
  • The image urls in the feed are replaced by an alternate url. This url is not protected by a referrer check so online feedreaders get the image

What It Not Does

  • It doesn’t protect the images in the feed. So hotlinking the image urls from the feed is possible. But in my opinion it is nearly impossible to protect this images without breaking some online feedreaders.
  • It doesn’t prevent someone from downloading your images and placing them on their own webspace

WordPress Shadow – Add Shadows to Your Images

Want to make your images on the posts with shadow? Yes, you can use a wordpress plugin named WordPress Shadows to add shadows to a range of objects. Currently supported are images, divs and blockquotes.

A very short post to introduce this plugin, I hope you don’t mind! @@