How to retrieve the current posts post type in wordpress ?

get_post_type   function is used for this.

$post_type = get_post_type($post_id);

// If this isn’t a ‘book’ post, don’t update it.

if ( “page” != $post_type )
{
echo “not page type”;
}