嗨,大家好我想回复自定义帖子类型lable / Menu_name。
实施例: 我创建名为:Product
的自定义帖子类型在产品类型中我添加冰淇淋。
所以我想在冰淇淋页面回应这个例子链接:
主页/产品/冰淇淋
基本上它就像自定义帖子类型的痕迹一样。
我需要帮助伙伴。
答案 0 :(得分:3)
获取post_type object获取标签“singular_name
或复数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.
答案 1 :(得分:2)
如果您使用wordpress自定义帖子类型,那么您可以通过以下功能获得所需信息:
自定义帖子类型标签
$ post_type = get_post_type_object(get_post_type($ post)); $ post_type->标签
自定义字段标题
$ field_name =" ice_cream&#34 ;; //自定义领域"冰淇淋" $ field = get_field_object($ field_name);
所以你可以在你的面包屑中使用它们: $ post_type-> label / $ field [' label']
答案 2 :(得分:0)
我相信Breadcrumb NavXT Wordpress插件支持在痕迹导航中使用自定义帖子类型:
http://wordpress.org/extend/plugins/breadcrumb-navxt/
http://mtekk.us/code/breadcrumb-navxt/
希望插件可以帮助您解决问题。