Move from get_post_type to get_query_var('post_type') as it is more reliable, fixes #80