首页 WordPress函数大全 get_post_type_labels()

get_post_type_labels()

2020-05-01 / 4268阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

Alert: This function’s access is marked private. This means it is not intended for use by plugin or theme developers,>object|WP_Post_Type $post_type_object )

Builds an object with all post type labels out of a post type object.

描述

Accepted keys of the label array in the post type object:

  • name – General name for the post type, usually plural. The same and overridden by $post_type_object->label. Default is ‘Posts’ / ‘Pages’.
  • singular_name – Name for> gettext context matching your post type. Example: _x( 'Add New', 'product', 'textdomain' );.
  • add_new_item – Label for adding a new singular item. Default is ‘Add New Post’ / ‘Add New Page’.
  • edit_item – Label for editing a singular item. Default is ‘Edit Post’ / ‘Edit Page’.
  • new_item – Label for the new item page title. Default is ‘New Post’ / ‘New Page’.
  • view_item – Label for viewing a singular item. Default is ‘View Post’ / ‘View Page’.
  • view_items – Label for viewing post type archives. Default is ‘View Posts’ / ‘View Pages’.
  • search_items – Label for searching plural items. Default is ‘Search Posts’ / ‘Search Pages’.
  • not_found – Label used when no items are found. Default is ‘No posts found’ / ‘No pages found’.
  • not_found_in_trash – Label used when no items are in the Trash. Default is ‘No posts found in Trash’ / ‘No pages found in Trash’.
  • parent_item_colon – Label used to prefix parents of hierarchical items. Not used>‘post_updated_messages’ filter.

参数

$post_type_object

(object|WP_Post_Type)
(Required)
Post type object.

返回

(object) Object with all the labels as member variables.

大家谈论
    我的见解