remove_post_type_support

Sponsored Link

取得する投稿タイプの為に特定の機能のサポートを削除します。全ての機能は、そのような編集画面やメタボックスなどの編集画面の機能エリアに直接関連付けられています。更に、’リビジョン’機能は、投稿タイプがリビジョンを保存するかどうかを指示し、’コメント’機能は編集画面にコメント数を表示するかどうかを指示します。

remove_post_type_support »

add_post_type_support

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

add_post_type_support »

get_post_format

記事の投稿フォーマットを返します。これは通常ループ内で呼び出されますが、投稿IDが提供されていればどこでも使用することができます。

Returns the post format of a post. This will usually be called in the the loop, but can be used anywhere if a post ID is provided.

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

<?php $format = get_post_format( $post_id ); ?>

get_post_formatのパラメーター

$post_id

(integer) (Optional)投稿のID。
デフォルト:現在のループ記事

(integer) (Optional) ID of the post.
Default: current loop post

Returns

Format (string)

投稿のフォーマットが、全くフォーマットが設定されていない場合は、false。
現在定義されている形式のセットは、次のとおりです。

The format of the post, or false if no format is set.
The set of currently defined formats is:

  • aside
  • chat
  • gallery
  • link
  • image
  • quote
  • status
  • video
  • audio

デフォルトのフォーマット(例、通常の投稿)がfalseを返すが、これは’標準’フォーマットとしていくつかの場所で呼ばれることにも注意してください。いくつかのケースでは、開発者が以下のような一貫性を維持するための何かをしたい場合:

Note also that the default format (i.e., a normal post) returns false, but this is also referred in some places as the ‘standard’ format. In some cases, developers may wish to do something like the following to maintain consistency:

$format = get_post_format();
if ( false === $format )
	$format = 'standard';

<?php
/*
 * Pull in a different sub-template, depending on the Post Format.
 * 
 * Make sure that there is a default '<tt>format.php</tt>' file to fall back to
 * as a default. Name templates '<tt>format-link.php</tt>', '<tt>format-aside.php</tt>', etc.
 *
 * You should use this in the loop.
 */

$format = get_post_format();
get_template_part( 'format', $format );
?>

変更ログ

Since: 3.1

ソースファイル

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

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

External Resources

  • Post types and formats and taxonomies, oh my! by Otto
  • WordPress 3.1 Post Formats Reference by Lisa Sabin-Wilson
  • Smarter Post Formats? by Dougal Campbell
  • Smarter Post Formats? Use Carrington by Alex King

関連ファンクションタグ

Post Formats: set_post_format(), get_post_format(), has_post_format()

set_post_type

投稿IDの投稿タイプを更新します。

ページまたは投稿キャッシュは投稿IDに消去されます。@uses $wpdbの名前は少ない。

set_post_type »

get_delete_post_link

文字列の値としてゴミ箱に投稿を移動するためのURLを返します。

WordPressのループ内や外部で使用できます。ページ、投稿、添付ファイル、およびリビジョンを使用することができます。

get_delete_post_link »

page_uri_index

ページURLの全てのページ及び添付ファイルを読み出します。

添付ファイルは親としてページを持ち、取得されるためのものです。

page_uri_index »

get_pages

この関数はブログで定義されている全てのページのリストを取得するために使用します。基本的にget_pagesはページの配列を与えて、配列はツリー状ではありません。ツリー状のような方法でページタイトルの出力のために、wp_list_pages()テンプレートを参照してください。

get_postsと同様にパラメータ名と異なる値であることに注意してください。

get_pages »

get_page_uri

ページのURIを構築します。

サブページは、親ページ投稿名の下に”directory”になります。

get_page_uri »

Sponsored Link