wpml language switcher shortcode

function language_switcher_fun( $atts ){
	ob_start();
	do_action('icl_language_selector');
	return ob_get_clean();
}
add_shortcode( 'language_switcher_shortcode', 'language_switcher_fun' );

You can use it like this [language_switcher_shortcode]

Include category id in body_class() and post_class()

Use this code on your themes functions.php to add current category id on body and post

function category_id_class($classes) {
	global $post;
	foreach ((get_the_category($post->ID)) as $category)
		$classes[] = 'cat-' . $category->cat_ID . '-id';
	return $classes;
}
add_filter('post_class', 'category_id_class');
add_filter('body_class', 'category_id_class');

Set a maximum upload count for users on a specific user role

Use the following code to limit 10 upload for specific role

add_filter( 'wp_handle_upload_prefilter', 'limit_uploads_for_user_roles' );

function limit_uploads_for_user_roles( $file ) {
  $user = wp_get_current_user();
  // add the role you want to limit in the array
  $limit_roles = array('contributor');
  $filtered = apply_filters( 'limit_uploads_for_roles', $limit_roles, $user );
  if ( array_intersect( $limit_roles, $user->roles ) ) {
    $upload_count = get_user_meta( $user->ID, 'upload_count', true ) ? : 0;
    $limit = apply_filters( 'limit_uploads_for_user_roles_limit', 10, $user, $upload_count, $file );
    if ( ( $upload_count + 1 ) > $limit ) {
      $file['error'] = __('Upload limit has been reached for this account!', 'yourtxtdomain');
    } else {
      update_user_meta( $user->ID, 'upload_count', $upload_count + 1 );
    }
  }
  return $file;
}

This action will fire when user delete attachment

add_action('delete_attachment', 'decrease_limit_uploads_for_user');

function decrease_limit_uploads_for_user( $id ) {
   $user = wp_get_current_user();
   // add the role you want to limit in the array
   $limit_roles = array('contributor');
   $filtered = apply_filters( 'limit_uploads_for_roles', $limit_roles, $user );
   if ( array_intersect( $limit_roles, $user->roles ) ) {
     $post = get_post( $id);
     if ( $post->post_author != $user->ID ) return;
     $count = get_user_meta( $user->ID, 'upload_count', true ) ? : 0;
     if ( $count ) update_user_meta( $user->ID, 'upload_count', $count - 1 );
   }
}

Thanks Giuseppe

Add logo to wordpress dashboard login without plugin

If you want to change the WordPress dashboard login logo then this piece of code can meet your requirement.

Just paste this code in the your theme functions.php

function custom_login_logo() {
    echo '<style type="text/css">
        h1 a { background-image:url('.get_bloginfo('template_directory').'/images/custom-login-logo.png) !important; }
    </style>';
}

add_action('login_head', 'custom_login_logo');