カスタム投稿タイプの名前を取得
1 |
$post_type = get_post_type( $post ); |
カスタム投稿タイプの情報を取得
1 2 3 |
$post_type_object = get_post_type_object( $post_type ); echo $post_type_object -> labels -> name;//名前 echo $post_type_object -> label;//名前(上と同じ?) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
stdClass Object ( [labels] => stdClass Object ( [name] => お知らせ// カスタム投稿タイプの名称(ラベル) [singular_name] => お知らせ [add_new] => お知らせを追加 [add_new_item] => 新しいお知らせを追加 [edit_item] => お知らせを編集 [new_item] => 新しいお知らせ [view_item] => お知らせを編集 [search_items] => お知らせを探す [not_found] => お知らせはありません [not_found_in_trash] => ゴミ箱にお知らせはありません [parent_item_colon] => ) [description] => [publicly_queryable] => 1 [exclude_from_search] => [_builtin] => [_edit_link] => post.php?post=%d [capability_type] => post [hierarchical] => [public] => 1 [rewrite] => Array ( [slug] => information// 投稿タイプのスラッグ(名前) [with_front] => 1 ) [query_var] => information [register_meta_box_cb] => [taxonomies] => Array// 紐付けされているタクソノミー ( [0] => information_type ) [show_ui] => 1 [menu_position] => 2 [menu_icon] => [permalink_epmask] => 1 [can_export] => 1 [show_in_nav_menus] => 1 [name] => information// 投稿タイプの名前(スラッグ) [cap] => stdClass Object ( [edit_post] => edit_post [edit_posts] => edit_posts [edit_others_posts] => edit_others_posts [publish_posts] => publish_posts [read_post] => read_post [read_private_posts] => read_private_posts [delete_post] => delete_post ) [label] => お知らせ// カスタム投稿タイプの名称(ラベル) ) |