Back to Community

How to Display Custom Post Type Titles and Labels with Shortcodes

13 threads Sep 16, 2025 PluginCustom post type ui

Content

Many WordPress users who create custom post types with the Custom Post Type UI plugin eventually need to display those post type names or labels on their website. Whether you want to show "Movies" above your movie listings or indicate which post type a search result comes from, this is a common requirement that isn't built directly into the plugin.

Why This Happens

The Custom Post Type UI plugin focuses exclusively on registering and managing custom post types in WordPress. It doesn't include frontend display functionality like shortcodes for showing post type names or labels. This is by design - the plugin handles the backend registration while themes and other plugins typically handle display.

The Solution: Create Your Own Shortcode

Based on community solutions from the BugWP forums, here's how you can create a shortcode to display your custom post type labels anywhere on your site:

add_shortcode( 'post_type_title', 'custom_post_type_title_shortcode' );
function custom_post_type_title_shortcode( $atts ) {
    $atts = shortcode_atts( [
        'post_type' => '',
    ], $atts );

    if ( empty( $atts['post_type'] ) ) {
        return '';
    }

    $obj = get_post_type_object( $atts['post_type'] );

    return $obj->label;
}

How to Use This Shortcode

Once you've added this code to your theme's functions.php file or a custom plugin, you can use the shortcode in several ways:

  • Basic usage: [post_type_title post_type="movies"] - displays "Movies"
  • In templates: <?php echo do_shortcode( '[post_type_title post_type="fruits"]' ); ?>
  • In widgets: Simply paste the shortcode into any text widget

Alternative Approaches

If you need more complex displays, consider these alternatives:

  • Custom PHP in templates: Use get_post_type_object() directly in your theme files
  • Page builders: Many builders like Elementor or Oxygen have dynamic data capabilities that can display post type information
  • Archive titles: For archive pages, your theme should automatically display the post type label

Important Notes

Remember that display issues are often theme-related. If you're having trouble with titles showing or hiding, check your theme settings first. The Custom Post Type UI team focuses on post type registration rather than frontend display, so most visual customization needs to be handled through your theme or custom code.

This solution has been tested by the BugWP community and provides a reliable way to display your custom post type labels without additional plugins.