Office Address

41/D, West Brahmondi, Narsingdi

Phone Number


Email Address

Today i organize some very useful WordPress hacks.Hope this may help you in your future projects

Display number of Facebook fans in full text

If you want to display the number of your Facebook Fans then use this code.

Replace “YOUR PAGE-ID” with your own Page-ID.


[php]$page_id = "YOUR PAGE-ID"; $xml = @simplexml_load_file("".$page_id."") or die ("a lot"); $fans = $xml—>page->fan_count;
echo $fans;


Display search terms from Google users

If a visitor reached your site through Google’s search, this script will display the terms they searched for in order to find your site. Put this code where you want to display the message.

[php]$refer = $_SERVER["HTTP_REFERER"];
if (strpos($refer, "google")) {
$refer_string = parse_url($refer, PHP_URL_QUERY);
parse_str($refer_string, $vars);
$search_terms = $vars[‘q’];
echo ‘Welcome Google visitor! You searched for the following terms to get here: ‘;
echo $search_terms;


How to automatically email contributors when their posts are published

If you’re running a multi-authored blog, it can be very cool to let your contributors know when their post are online. Today’s recipe will show you how to do this automatically each time a post is published.

[php]function wpr_authorNotification($post_id) { $post = get_post($post_id); $author = get_userdata($post->post_author); $message = " Hi ".$author->display_name.", Your post, ".$post->post_title." has just been published. Well done! "; wp_mail($author->user_email, "Your article is online", $message); } add_action(‘publish_post’, ‘wpr_authorNotification’);[/php]


How to define a minimum word count per post

If you want to be able to keep a minimum word count for your posts, then just read this recipe. Applying it to your blog can be useful to maintain a clean layout, or ensure your guest writers will not post too short articles on your blog.

[php]function minWord($content){ global $post; $num = 100; //set this to the minimum number of words $content = $post->post_content; if (str_word_count($content) < $num) wp_die( __(‘Error: your post is below the minimum word count.’) ); } add_action(‘publish_post’, ‘minWord’);[/php]


Automatically add a Google+ button to your posts

This simple piece of code to automatically add a Google+ button to your posts.

Open your functions.php file and paste the following code in it:

[php]add_filter(‘the_content’, ‘wpr_google_plusone’); function wpr_google_plusone($content) { $content = $content.'<div><g:plusone size="tall" href="’.get_permalink().’"></g:plusone></div>’; return $content; } add_action (‘wp_enqueue_scripts’,’wpr_google_plusone_script’); function wpr_google_plusone_script() { wp_enqueue_script(‘google-plusone’, ‘’, array(), null); }[/php]


Written by

Maidul Islam

I am a freelance web developer.Like to share what i learn.