Title: Shortcode for custom post type title
Last modified: January 18, 2022

---

# Shortcode for custom post type title

 *  Resolved [nick1999](https://wordpress.org/support/users/nick1999/)
 * (@nick1999)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/shortcode-for-custom-post-type-title/)
 * Hi CPTUI support team,
 * Do you have any shortcode to display only the title of the custom post type. 
   Or could you guide me on how to achieve this?
 * I am waiting for your reply,
    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [4 years, 4 months ago](https://wordpress.org/support/topic/shortcode-for-custom-post-type-title/#post-15266088)
 * Are you trying to display the current post’s title dynamically in some way? or
   perhaps inside its own post content? Or somewhere else?
 * Not quite sure on the usecase here, which would help me provide a better answer.
 *  Thread Starter [nick1999](https://wordpress.org/support/users/nick1999/)
 * (@nick1999)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/shortcode-for-custom-post-type-title/#post-15268327)
 * I created a post-type Movie and I have published some posts on it now I want 
   to show the Custom post type title (i mean I want to show the word “movies”) 
   in the posts of Movie only.
 * I am waiting for your reply,
    Thanks.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [4 years, 4 months ago](https://wordpress.org/support/topic/shortcode-for-custom-post-type-title/#post-15269102)
 * Something like this should work
 *     ```
       add_shortcode( 'post_type_title', 'nick1999_post_type_title' );
       function nick1999_post_type_title( $atts ) {
       	$atts = shortcode_atts( [
       		'post_type' => '',
       	], $atts );
   
       	if ( empty( $atts['post_type'] ) ) {
       		return '';
       	}
   
       	$obj = get_post_type_object( $atts['post_type'] );
   
       	return $obj->label;
       }
       ```
   
 * Usage example: `[post_type_title post_type="movies"]`
 * Would return: `Movies` if the plural label is as such. Editing the plural label
   later would affect all of the instances of the shortcode.
 *  Thread Starter [nick1999](https://wordpress.org/support/users/nick1999/)
 * (@nick1999)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/shortcode-for-custom-post-type-title/#post-15300027)
 * Hi,
    Thanks for your support, my issue has been solved, you can mark this thread
   as resolved, Thank you, Sir.
 *  Plugin Contributor [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * (@tw2113)
 * The BenchPresser
 * [4 years, 4 months ago](https://wordpress.org/support/topic/shortcode-for-custom-post-type-title/#post-15300060)
 * Glad we could help. Let us know if anything else comes up.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Shortcode for custom post type title’ is closed to new replies.

 * ![](https://ps.w.org/custom-post-type-ui/assets/icon-256x256.png?rev=2744389)
 * [Custom Post Type UI](https://wordpress.org/plugins/custom-post-type-ui/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/custom-post-type-ui/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/custom-post-type-ui/)
 * [Active Topics](https://wordpress.org/support/plugin/custom-post-type-ui/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/custom-post-type-ui/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/custom-post-type-ui/reviews/)

 * 5 replies
 * 2 participants
 * Last reply from: [Michael Beckwith](https://wordpress.org/support/users/tw2113/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/shortcode-for-custom-post-type-title/#post-15300060)
 * Status: resolved