Created
May 15, 2016 12:08
-
-
Save jeremyboggs/445e0cafb3ed826ab2c22a0f826a7cfd to your computer and use it in GitHub Desktop.
Display the singular label for a post type in WordPress. (Sigh....)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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