add_post_type_support

Sponsored Link

任意の投稿タイプの特定の機能のサポートを登録します。各機能は、例えばエディターやメタボックスなど、投稿編集画面に表示されている対応しているフィールドに直接影響があります。さらに、’リビジョン’機能は投稿タイプがリビジョンを保存するかどうかを指示し、’コメント’機能はコメント数が投稿編集画面に表示するかどうかを指示します。

Sponsored Link

Registers support of certain feature(s) for a given post type. Each feature has a direct impact on the corresponding field displayed in the post edit screen, such as the editor or a meta box. Additionally, the ‘revisions’ feature dictates whether the post type will store revisions, and the ‘comments’ feature dictates whether the comments count will show on the post edit screen.

add_post_type_supportのファンクションタグ使用方法

<?php add_post_type_support( $post_type, $supports ) ?>

add_post_type_supportのパラメーター

$post_type

(string) (required)投稿タイプ。(最大20文字)
デフォルト:なし

(string) (required) Post type. (max. 20 characters)
Default: None

$supports

(string/array) (required)追加する機能です。

(string/array) (required) Feature to add.

  • ‘title’
  • ‘editor’ (content)
  • ‘author’
  • ‘thumbnail’ (featured image) (現在のテーマが投稿サムネイルをサポートしている必要があります。)
  • ‘excerpt’
  • ‘trackbacks’
  • ‘custom-fields’
  • ‘comments’ (編集画面にコメント数のバルーンを参照するでしょう。)
  • ‘revisions’ (リビジョンを保存します)
  • ‘page-attributes’ (テンプレートとメニューの順序) (階層はtrueでなければならない) (ページテンプレートのセレクターはページの投稿タイプに対してのみ使用可能です。)
  • ‘post-formats’ 投稿フォーマットを追加し、投稿フォーマットを参照してください。
  • ‘title’
  • ‘editor’ (content)
  • ‘author’
  • ‘thumbnail’ (featured image) (current theme must also support Post Thumbnails)
  • ‘excerpt’
  • ‘trackbacks’
  • ‘custom-fields’
  • ‘comments’ (also will see comment count balloon on edit screen)
  • ‘revisions’ (will store revisions)
  • ‘page-attributes’ (template and menu order) (hierarchical must be true) (the page template selector is only available for the page post type)
  • ‘post-formats’ add post formats, see Post Formats

Default: なし

マルチサイト

マルチサイトのインストールで”アイキャッチ画像”のメタボックスを表示するには、ネットワーク管理者内で、ネットワーク管理者の設定のサブパネル#Upload_Settings、メディアアップロードのボタンオプションで、ファイルタイプをアップロードする許可をアップデートを確認してください。デフォルトはオフです。

To show the “Featured Image” meta box in mulsite installation, make sure you update the allowed upload file types, in Network Admin, Network Admin Settings SubPanel#Upload_Settings, Media upload buttons options. Default is off.

この例ではページ内に抜粋のためのサポートを追加します(仮定しているのは、”画面オプション”の下に表示されて”いません”)

This example adds support for excerpts in Pages (assuming it is *not* showing under “Screen Options”):

<?php
add_action('init', 'my_custom_init');
function my_custom_init() {
	add_post_type_support( 'page', 'excerpt' );
}
?>

注意

関数は、上記の例のように、initアクションフックを使用して呼び出す必要があります。

The function should be called using the init action hook, like in the above example.

変更ログ

Since 3.0

ソースファイル

add_post_type_support()は、wp-includes/post.php内に位置しています。

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

関連ファンクションタグ

Post Types: register_post_type(), add_post_type_support(), remove_post_type_support(), post_type_supports(), post_type_exists(), set_post_type(), get_post_type(), get_post_types(), get_post_type_object(), get_post_type_capabilities(), get_post_type_labels(), is_post_type_hierarchical(), is_post_type_archive(), post_type_archive_title()

Sponsored Link