Wordpress get custom post type label name

Abdullah picture Abdullah · Jul 6, 2012 · Viewed 11.4k times · Source

Hi Guys i want to echo custom post type lable/Menu_name.

Example: I create custom post type named: Product

In product post type i add post Ice Cream.

So i want to echo in ice cream page this example link:

Home/product/Icecream

Basically its like breadcrumb for custom post type.

I need Help Guys.

Answer

Aurovrata picture Aurovrata · Apr 30, 2017

Get the post_type object to get the labels' singular_name or plural name,

$post_type_obj = get_post_type_object( 'ice_cream' );
echo $post_type_obj->labels->singular_name; //Ice Cream.
echo $post_type_obj->labels->name; //Ice Creams.