• 赤色のリンクは、まだ日本語Codexに存在しないページ・画像です。英語版と併せてご覧ください。(詳細

このWikiはいつでも誰でも編集できます

「関数リファレンス/register post type」の版間の差分

提供: WordPress Codex 日本語版
移動先: 案内検索
(en:Function Reference/register_post_type 14:38, 10 April 2010 Bono 版を翻訳用にコピー)
 
(リンク等調整)
1行目: 1行目:
 +
{{NeedTrans}}
 
{{Draft}}
 
{{Draft}}
 +
{{テンプレートタグガイド|PHP}}
 
== Description ==
 
== Description ==
Create or modify a [[Glossary#Post Type|post type]]. The function will accept an array ([[#$args|second optional parameter]]), along with a string for the post type name.
+
 
 +
Create or modify a [[用語集#Post Type|post type]]. The function will accept an array ([[#$args|second optional parameter]]), along with a string for the post type name.
 
Do not use before init.
 
Do not use before init.
 +
 
== Usage ==
 
== Usage ==
%%%<?php register_post_type( $post_type, $args ) ?>%%%
+
 
 +
<?php register_post_type( $post_type, $args ) ?>
 +
 
 
== Parameters ==
 
== Parameters ==
 +
 
{{Parameter|$post_type|string|Post type.}}
 
{{Parameter|$post_type|string|Post type.}}
 
{{Parameter|$args|array|An array of arguments.|optional}}
 
{{Parameter|$args|array|An array of arguments.|optional}}
45行目: 52行目:
 
{{Parameter|hierarchical|boolean|Whether the post type is hierarchical.|optional|false}}
 
{{Parameter|hierarchical|boolean|Whether the post type is hierarchical.|optional|false}}
  
{{Parameter|supports|array|An alias for calling [[Function Reference/add_post_type_support|add_post_type_support()]] directly.
+
{{Parameter|supports|array|An alias for calling [[関数リファレンス/add_post_type_support|add_post_type_support()]]/[[:en:Function Reference/add_post_type_support|en]] directly.
 
:* 'title'
 
:* 'title'
 
:* 'editor' (content)
 
:* 'editor' (content)
58行目: 65行目:
 
|optional}}
 
|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}}
+
{{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 [[関数リファレンス/remove_meta_box|remove_meta_box()]]/[[:en:Function Reference/remove_meta_box|en]] and [[関数リファレンス/add_meta_box|add_meta_box()]] calls in the callback.|optional}}
  
{{Parameter|taxonomies|array|An array of taxonomy identifiers that will be registered for the post type. Taxonomies can be registered later with [[Function Reference/register_taxonomy|register_taxonomy()]] or [[Function Reference/register_taxonomy_for_object_type|register_taxonomy_for_object_type()]].|optional}}
+
{{Parameter|taxonomies|array|An array of taxonomy identifiers that will be registered for the post type. Taxonomies can be registered later with [[関数リファレンス/register_taxonomy|register_taxonomy()]]/[[:en:Function Reference/register_taxonomy|en]] or [[関数リファレンス/register_taxonomy_for_object_type|register_taxonomy_for_object_type()]]/[[:en:Function Reference/register_taxonomy_for_object_type|en]].|optional}}
  
 
{{Parameter|menu_postition|string|The position in the menu order the post type should appear. |optional|null - defaults to the bottom}}
 
{{Parameter|menu_postition|string|The position in the menu order the post type should appear. |optional|null - defaults to the bottom}}
80行目: 87行目:
 
{{Parameter|__edit_link|boolean|Link to edit an entry with this post type. '''Note: this Codex entry is for documentation '-' core developers recommend you don't use this when registering your own post type'''|not for general use|}}
 
{{Parameter|__edit_link|boolean|Link to edit an entry with this post type. '''Note: this Codex entry is for documentation '-' core developers recommend you don't use this when registering your own post type'''|not for general use|}}
 
:* 'post.php?post=%d'
 
:* 'post.php?post=%d'
== Example ==
 
  
%%%<?php  
+
== Example ==
 +
<pre>
 +
<?php  
  
 
$args = array(
 
$args = array(
98行目: 106行目:
 
register_post_type( 'album' , $args );
 
register_post_type( 'album' , $args );
  
?> %%%
+
?>
 +
</pre>
  
== Change Log ==
+
== 変更履歴 ==
  
 
* Since [[Version 2.9|2.9]]
 
* Since [[Version 2.9|2.9]]
120行目: 129行目:
 
{{Tag Footer}}
 
{{Tag Footer}}
  
[[Category:Functions]]
+
{{DEFAULTSORT:Register_post_type}}
 +
[[Category:関数]]
 +
[[Category:wp2.9]]
  
 
[[en:Function Reference/register_post_type]]
 
[[en:Function Reference/register_post_type]]

2010年4月10日 (土) 23:50時点における版

このページ「関数リファレンス/register post type」は未翻訳です。和訳や日本語情報を加筆してくださる協力者を求めています

このページはラフドラフトで、まだ内容の検証が済んでいません。情報が間違っていたり書き直されることがあります。
執筆中のため、執筆者の許可なく編集しないでください

Description

Create or modify a post type. The function will accept an array (second optional parameter), along with a string for the post type name. Do not use before init.

Usage

<?php register_post_type( $post_type, $args ) ?>

Parameters

$post_type
string) (必須) Post type.
初期値: なし
$args
array) (optional) An array of arguments.
初期値: なし

$args

Known Parameters for $args are:

label
string) (optional) A plural descriptive name for the post type marked for translation.
初期値: $post_type
singular_label
string) (optional) A singular descriptive name for the post type marked for translation.
初期値: $label
description
string) (optional) A short descriptive summary of what the post type is.
初期値: blank
public
boolean) (optional) Whether posts of this type should be shown in the admin UI.
初期値: false
publicly_queryable
boolean) (optional) Whether post_type queries can be performed from the front page.
初期値: Whatever public is set as.
exclude_from_search
boolean) (importance) Whether to exclude posts with this post type from search results.
初期値: true if the type is not public, false if the type is public
show_ui
boolean) (optional) Whether to generate a default UI for managing this post type.
初期値: if not set, defaults to value of public argument
  • 'false' - do not display a user-interface for this post type
  • 'true' - display a user-interface (admin panel) for this post type
capability_type
string) (optional) The post type to use for checking read, edit, and delete capabilities.
初期値: "post"
edit_cap
string) (optional) The capability that controls editing a particular object of this post type.
初期値: "edit_$capability_type" (edit_post).
edit_type_cap
string) (optional) The capability that controls editing objects of this post type as a class.
初期値: "edit_ . $capability_type . s" (edit_posts).
edit_others_cap
string) (optional) The capability that controls editing objects of this post type that are owned by other users.
初期値: "edit_others_ . $capability_type . s" (edit_others_posts).
publish_others_cap
string) (optional) The capability that controls publishing objects of this post type.
初期値: "publish_ . $capability_type . s" (publish_posts).
read_cap
string) (optional) The capability that controls reading a particular object of this post type.
初期値: "read_$capability_type" (read_post).
delete_cap
string) (optional) The capability that controls deleting a particular object of this post type.
初期値: "delete_$capability_type" (delete_post).
hierarchical
boolean) (optional) Whether the post type is hierarchical.
初期値: false
supports
array) (optional) An alias for calling add_post_type_support()/en directly.
  • 'title'
  • 'editor' (content)
  • 'author'
  • 'thumbnail'
  • 'excerpts'
  • 'trackbacks'
  • 'custom-fields'
  • 'comments'
  • 'revisions'
  • 'page-attributes' (parent, template, and menu order)
初期値: なし
register_meta_box_cb
string) (optional) Provide a callback function that will be called when setting up the meta boxes for the edit form. Do remove_meta_box()/en and add_meta_box() calls in the callback.
初期値: なし
taxonomies
array) (optional) An array of taxonomy identifiers that will be registered for the post type. Taxonomies can be registered later with register_taxonomy()/en or register_taxonomy_for_object_type()/en.
初期値: なし
menu_postition
string) (optional) The position in the menu order the post type should appear.
初期値: null - defaults to the bottom
menu_icon
string) (optional) The url to the icon to be used for this menu.
初期値: null - defaults to the posts icon
permalink_epmask
string) (optional) The url to the icon to be used for this menu.
初期値: EP_NONE
rewrite
array) (optional) Rewrite permalinks with this format.
初期値: false
  • 'slug' - defaults to post_type
  • 'with_front' - defaults to true
query_var
boolean) (optional) Name of the query var to use for this post type.
初期値: false
_builtin
boolean) (not for general use) Whether this post type is a native or "built-in" post_type. Note: this Codex entry is for documentation - core developers recommend you don't use this when registering your own post type
初期値: false
  • 'false' - default this is a custom post type
  • 'true' - this is a built-in native post type (post, page, attachment, revision, nav_menu_item)
__edit_link
boolean) (not for general use) Link to edit an entry with this post type. Note: this Codex entry is for documentation '-' core developers recommend you don't use this when registering your own post type
初期値:
  • 'post.php?post=%d'

Example

<?php 

$args = array(
        'label' => __('Albums'),
        'singular_label' => __('Album'),
        'public' => true,
        'show_ui' => true,
        'capability_type' => 'page',
        'hierarchical' => false,
        'rewrite' => true,
        'query_var' => 'album',
        'supports' => array('title', 'thumbnail')
        );

register_post_type( 'album' , $args );

?>

変更履歴

Source File

register_post_type() is located in wp-includes/post.php.

Resources

最新英語版: WordPress Codex » Function Reference/register_post_type最新版との差分

Related

関数リファレンステンプレートタグ目次もご覧ください。