WordPress: Remove Gravatar

A quick tip to remove default wordpress Gravatar avatar links. “avatar.jpg” is default avatar locates at theme directory/images folder, you can change it to any image you want.

// Remove Gravatar
function bp_remove_gravatar ($image, $params, $item_id, $avatar_dir, $css_id, $html_width, $html_height, $avatar_folder_url, $avatar_folder_dir) {

	$default = get_stylesheet_directory_uri() .'/images/avatar.jpg';

	if( $image && strpos( $image, "gravatar.com" ) ){ 

		return '<img class="avatar" src="' . $default . '" alt="avatar" />';
	} else {
		return $image;


add_filter('bp_core_fetch_avatar', 'bp_remove_gravatar', 1, 9 );

function remove_gravatar ($avatar, $id_or_email, $size, $default, $alt) {

	$default = get_stylesheet_directory_uri() .'/images/avatar.jpg';
	return "<img class="avatar avatar-{$size} photo avatar-default" src="{$default}" alt="{$alt}" width="{$size}" height="{$size}" />";

add_filter('get_avatar', 'remove_gravatar', 1, 5);

function bp_remove_signup_gravatar ($image) {

	$default = get_stylesheet_directory_uri() .'/images/avatar.png';

	if( $image &amp;&amp; strpos( $image, "gravatar.com" ) ){ 

		return '<img class="avatar" src="' . $default . '" alt="avatar" width="60" height="60" />';
	} else {
		return $image;

add_filter('bp_get_signup_avatar', 'bp_remove_signup_gravatar', 1, 1 );

WordPress: Add custom post-types to main query

Some days ago, i had a problem with my website and wordpress post-types. I added some custom post-types but couldnt show those posts on my homepage because by default, main post query just fetchs posts from post-type POST, not from all custom post-types. Finally, i fixed that issue with below extra code. The code should be added to function.php of your theme.

// Add custom post types to main query
add_filter( 'pre_get_posts', 'my_get_post_types' );

function my_get_post_types( $query ) {

	if ( is_home() && $query->is_main_query() )
		$query->set( 'post_type', array( 'post', 'videos', 'cheats', 'photos') ); // add your custom post-type here

	return $query;


WordPress: Required Password at Register Form

By default, WordPress dont have function to allow users choose their own password when registering on your blog. For security purpose, Password will be mailed to your registration email, but sometime users dont change their password at the first time they log in to your blog; the result is they will forget it or hard to find the password in mailbox. If you want to let them choose their password, you have to write some code to add Password fields to your blog register form. Here its:
Continue reading “WordPress: Required Password at Register Form”

Best WordPress Plugins

Today, i would like to recommend you some best wordpress plugins and must-have plugins if you are planning to open a wordpress blog/website. As we know, wordpress have a ton of plugins to choose, have useful plugins and outdated plugins too. After installing wordpress, you should consider to choose right plugins for your purpose. Just take a look our recommended wordpress plugins:

1. Contact Form 7

By default, WordPress dont have Contact form, we need to create own contact form. Contact form 7 can help you on that, its simple,  fletxible plugin, easy to use and configure thats what i can say about Contact Form 7.

Contact Form 7 can manage multiple contact forms, plus you can customize the form and the mail contents flexibly with simple markup. The form supports Ajax-powered submitting, CAPTCHA, Akismet spam filtering and so on. And supports multi languages.

If you want to use reCaptcha with Contact Form 7, you need one more plugin named Contact Form 7 reCAPTCHA Extension or Contact Form 7 BWP reCAPTCHA Extension.

Dont forget to get a recaptcha key at http://www.google.com/recaptcha/whyrecaptcha

With those plugins, you can also replace default WordPress Captcha with reCaptcha and enhance your spam protect system.

2. All In One SEO Pack (Free)

This is WordPress SEO plugin to automatically optimize your WordPress blog for Search Engines.

Some features:

  • Google Analytics support
  • Support for Custom Post Types
  • Advanced Canonical URLs
  • Fine tune Page Navigational Links
  • Built-in API so other plugins/themes can access and extend functionality
  • ONLY plugin to provide SEO Integration for WP e-Commerce sites
  • Nonce Security
  • Support for CMS-style WordPress installations
  • Automatically optimizes your titles for search engines
  • Generates META tags automatically
  • Avoids the typical duplicate content found on WordPress blogs
  • For beginners, you don’t even have to look at the options, it works out-of-the-box. Just install.
  • For advanced users, you can fine-tune everything
  • You can override any title and set any META description and any META keywords you want.
  • Backward-Compatibility with many other plugins, like Auto Meta, Ultimate Tag Warrior and others.

Continue reading “Best WordPress Plugins”

Build your own community with WordPress, BuddyPress and BBpress

You are planning to build a community/social network? if YES, here is your solution: WordPress + BuddyPress + BBpress

1. WordPress:

WordPress is web software you can use to create a beautiful website or blog. We like to say that WordPress is both free and priceless at the same time.

The core software is built by hundreds of community volunteers, and when you’re ready for more there are thousands of plugins and themes available to transform your site into almost anything you can imagine. Over 60 million people have chosen WordPress to power the place on the web they call “home” — we’d love you to join the family.”

Official website: http://wordpress.org/

Might be you think WordPress is for bloggers only. BUT NOT anymore, WordPress is most powerful web software nowaday, you can customize WordPress for most of your projects. Fully customize and have alot plugins.

Continue reading “Build your own community with WordPress, BuddyPress and BBpress”