Get post-type info

/** 
 * Get the post-type info. 
 *
 * Use: Call function <?php is_post_type('post-type'); ?>
 * Function is used to determine if current post is of a certain post-type.
 */
function is_post_type($type){
    global $wp_query;
    if($type == get_post_type($wp_query->post->ID)) {
    	return true;

    } else {
        return false;
    }
}

This wpsnipp.it checks if the post-type passed in is of a certain type. This is helpful if you need to add extra functionality to a special post-type.

«

Leave a Reply