- 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細)
関数リファレンス/get post type labels
提供: WordPress Codex 日本語版
< 関数リファレンス
この関数へのアクセスは プライベートとしてマークされています。それはコア関数でのみ使われ、プラグインやテーマ開発者は使用しないでください。万全を期すためにここに掲載されています。
代わりに get_post_type_object を使用してください。
説明
投稿タイプのオブジェクトから全ての投稿タイプのラベルをオブジェクトとして築きます。
投稿タイプのオブジェクトラベルのキーとして認められます。
- name - general name for the post type, usually plural. The same and overriden by $post_type_object->label. Default is Posts/Pages
- singular_name - name for one object of this post type. Default is Post/Page
- add_new - Default is Add New for both hierarchical and non-hierarchical types. When internationalizing this string, please use a {@link http://codex.wordpress.org/I18n_for_WordPress_Developers#Disambiguation_by_context gettext context} matching your post type. Example:
_x('Add New', 'product');
- add_new_item - Default is Add New Post/Add New Page
- edit_item - Default is Edit Post/Edit Page
- new_item - Default is New Post/New Page
- view_item - Default is View Post/View Page
- search_items - Default is Search Posts/Search Pages
- not_found - Default is No posts found/No pages found
- not_found_in_trash - Default is No posts found in Trash/No pages found in Trash
- parent_item_colon - This string isn't used on non-hierarchical types. In hierarchical ones the default is Parent Page:
Above, the first default value is for non-hierarchical post types (like posts) and the second one is for hierarchical post types (like pages).
使い方
<?php get_post_type_labels( $post_type_object ); ?>
パラメータ
- $post_type_object
- (object) (required)
- 初期値: なし
戻り値
- (object)
- メンバー変数など、すべてのラベルを持つオブジェクト
フィルター
- 'post_type_labels_{$post_type}' called on return object:
apply_filters( 'post_type_labels_example_custom_post_type', $labels )
更新履歴
新規導入: 3.0
ソースファイル
get_post_type_labels() は wp-includes/post.php
にあります。
関数リファレンス、テンプレートタグ目次もご覧ください。
最新英語版: WordPress Codex » Function_Reference/get_post_type_labels (最新版との差分)