2012-12-28

Parameters:

← Older revision

Revision as of 22:45, 28 December 2012

(One intermediate revision not shown)

Line 32:

Line 32:

{{Parameter|labels|array|labels - An array of labels for this post type. By default post labels are used for non-hierarchical types and page labels for hierarchical ones.|optional|if empty, name is set to label value, and singular_name is set to name value}}

{{Parameter|labels|array|labels - An array of labels for this post type. By default post labels are used for non-hierarchical types and page labels for hierarchical ones.|optional|if empty, name is set to label value, and singular_name is set to name value}}



:* 'name' - general name for the post type, usually plural. The same as, and overridden by $post_type_object->label

+

:* ''''name'''' - general name for the post type, usually plural. The same as, and overridden by $post_type_object->label



:* 'singular_name' - name for one object of this post type. Defaults to value of name

+

:* ''''singular_name'''' - name for one object of this post type. Defaults to value of name



:* 'add_new' - the add new text. The default is Add New for both hierarchical and non-hierarchical types. When internationalizing this string, please use a [[I18n_for_WordPress_Developers#Disambiguation_by_context|gettext context]] matching your post type. Example: _x('Add New', 'product');

+

:* ''''menu_name'''' - the menu name text. This string is the name to give menu items. Defaults to value of name



:* 'all_items' - the all items text used in the menu. Default is the Name label

+

:* ''''all_items'''' - the all items text used in the menu. Default is the Name label



:* 'add_new_item' - the add new item text. Default is Add New Post/Add New Page

+

:* ''''add_new'''' - the add new text. The default is Add New for both hierarchical and non-hierarchical types. When internationalizing this string, please use a [[I18n_for_WordPress_Developers#Disambiguation_by_context|gettext context]] matching your post type. Example: _x('Add New', 'product');



:* 'edit_item' - the edit item text. Default is Edit Post/Edit Page

+

:* ''''add_new_item'''' - the add new item text. Default is Add New Post/Add New Page



:* 'new_item' - the new item text. Default is New Post/New Page

+

:* ''''edit_item'''' - the edit item text. Default is Edit Post/Edit Page



:* 'view_item' - the view item text. Default is View Post/View Page

+

:* ''''new_item'''' - the new item text. Default is New Post/New Page



:* 'search_items' - the search items text. Default is Search Posts/Search Pages

+

:* ''''view_item'''' - the view item text. Default is View Post/View Page



:* 'not_found' - the not found text. Default is No posts found/No pages found

+

:* ''''search_items'''' - the search items text. Default is Search Posts/Search Pages



:* 'not_found_in_trash' - the not found in trash text. Default is No posts found in Trash/No pages found in Trash

+

:* ''''not_found'''' - the not found text. Default is No posts found/No pages found



:* 'parent_item_colon' - the parent text. This string isn't used on non-hierarchical types. In hierarchical ones the default is Parent Page

+

:* ''''not_found_in_trash'''' - the not found in trash text. Default is No posts found in Trash/No pages found in Trash



:* 'menu_name' - the menu name text. This string is the name to give menu items. Defaults to value of name

+

:* ''''parent_item_colon'''' - the parent text. This string isn't used on non-hierarchical types. In hierarchical ones the default is Parent Page

{{Parameter|description|string|A short descriptive summary of what the post type is.|optional|blank}}

{{Parameter|description|string|A short descriptive summary of what the post type is.|optional|blank}}

{{Parameter|public|boolean|Whether a post type is intended to be used publicly either via the admin interface or by front-end users.|optional|false}}

{{Parameter|public|boolean|Whether a post type is intended to be used publicly either via the admin interface or by front-end users.|optional|false}}



:* 'false' - Post type is not intended to be used publicly and should generally be unavailable in wp-admin and on the front end unless explicitly planned for elsewhere.

+

:* ''''false'''' - Post type is not intended to be used publicly and should generally be unavailable in wp-admin and on the front end unless explicitly planned for elsewhere.



:* 'true' - Post type '''is''' intended for public use. This includes on the front end and in wp-admin.

+

:* ''''true'''' - Post type '''is''' intended for public use. This includes on the front end and in wp-admin.

: '''Note:''' While the default settings of exclude_from_search, publicly_queryable, show_ui, and show_in_nav_menus are inherited from public, each does not rely on this relationship and controls a very specific intention.

: '''Note:''' While the default settings of exclude_from_search, publicly_queryable, show_ui, and show_in_nav_menus are inherited from public, each does not rely on this relationship and controls a very specific intention.

Line 151:

Line 151:

{{Parameter|hierarchical|boolean|Whether the post type is hierarchical (e.g. page). Allows Parent to be specified. The 'supports' parameter should contain 'page-attributes' to show the parent select box on the editor page.|optional|false}}

{{Parameter|hierarchical|boolean|Whether the post type is hierarchical (e.g. page). Allows Parent to be specified. The 'supports' parameter should contain 'page-attributes' to show the parent select box on the editor page.|optional|false}}



{{Parameter|supports|array|An alias for calling [[Function Reference/add_post_type_support|add_post_type_support()]] directly.|optional|title and editor}}

+

{{Parameter|supports|array/boolean|An alias for calling [[Function Reference/add_post_type_support|add_post_type_support()]] directly. As of [[Version_3.5|3.5]], boolean false can be passed as value instead of an array to prevent default (title and editor) behavior.|optional|title and editor}}

:* 'title'

:* 'title'

:* 'editor' (content)

:* 'editor' (content)

Line 163:

Line 163:

:* 'page-attributes' (menu order, hierarchical must be true to show Parent option)

:* 'page-attributes' (menu order, hierarchical must be true to show Parent option)

:* 'post-formats' add post formats, see [[Post Formats]]

:* 'post-formats' add post formats, see [[Post Formats]]



'''Note:''' As of [[Version_3.5|3.5]], boolean false can be passed as value instead of an array to prevent default (title and editor) behavior.

{{Parameter|register_meta_box_cb|string|Provide a callback function that will be called when setting up the meta boxes for the edit form. Do [[Function Reference/remove_meta_box|remove_meta_box()]] and [[Function Reference/add_meta_box|add_meta_box()]] calls in the callback.|optional}}

{{Parameter|register_meta_box_cb|string|Provide a callback function that will be called when setting up the meta boxes for the edit form. Do [[Function Reference/remove_meta_box|remove_meta_box()]] and [[Function Reference/add_meta_box|add_meta_box()]] calls in the callback.|optional}}

Show more