Skip to content

Instantly share code, notes, and snippets.

@jeremyboggs
Created May 15, 2016 12:08
Show Gist options
  • Save jeremyboggs/445e0cafb3ed826ab2c22a0f826a7cfd to your computer and use it in GitHub Desktop.
Save jeremyboggs/445e0cafb3ed826ab2c22a0f826a7cfd to your computer and use it in GitHub Desktop.
Display the singular label for a post type in WordPress. (Sigh....)
<?php
$post_type = get_query_var( 'post_type' );
if ( is_array( $post_type ) ) {
$post_type = reset( $post_type );
}
$post_type_obj = get_post_type_object( $post_type );
?>
<h1><?php echo $post_type_obj->labels->singular_name; ?></h1>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment