get_page

Sponsored Link

ページIDまたはページオブジェクトを取得してページデータを指定します。

ページは、記事のようなもの、アーカイブ、WordPressの他のブログのエントリー機能に影響を与えない静的なコンテンツを持つ方法を提供します。静的なコンテンツへのブログエントリーを有効にする単純な方法です。

Sponsored Link

Retrieves page data given a page ID or page object.

Pages provide a way to have static content that will not affect things like articles or archives or any other blog entry features of WordPress. Its simply a way to turn a blog entry into static content.

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

<?php get_page( $page_id ) ?>

get_pageのパラメーター

$page_id

(integer) (optional) 参照によって渡されるページIDです(以下の例を参照)
デフォルト:時間関数でグローバル変数からページIDが呼び出されます。

(integer) (optional) Page ID passed by reference (see example below)
Default: Page ID from global variable at time function is called

$output

(OBJECT/ARRAY_A/ARRAY_N) (optional) どのような出力にするか。
デフォルト:OBJECT

(OBJECT/ARRAY_A/ARRAY_N) (optional) What to output.
Default: OBJECT

$filter

(string) (optional) どのような方法で戻り値がフィルタリングする必要があるか。
オプションは、’raw’, ‘edit’, ‘db’, ‘display’, ‘attribute’ と ‘js’です。’attribute’ と ‘js’のコンテキストは’display’のように扱われます。
デフォルト:’raw’

(string) (optional) How the return value should be filtered. Options are ‘raw’, ‘edit’, ‘db’, ‘display’, ‘attribute’ and ‘js’. The ‘attribute’ and ‘js’ contexts are treated like ‘display’.
Default: ‘raw’

戻り値

(object|array)
ページのデータを適合する。

(object|array)
mixed Page data.

   [ID]=> (integer)
   [post_author]   => (integer)
   [post_date] => (YYYY-MM-DD HH:MM:SS)
   [post_date_gmt] => (YYYY-MM-DD HH:MM:SS)
   [post_content]  => (all post content is in here)
   [post_title]=> (Post Title Here)
   [post_excerpt]  => (Post Excerpt)
   [post_status]   => (? | publish)
   [comment_status]=> (? | closed)
   [ping_status]   => (? | closed)
   [post_password] => (blank if not specified)
   [post_name] => (slug-is-here)
   [to_ping]   => (?)
   [pinged]=> (?)
   [post_modified] => (YYYY-MM-DD HH:MM:SS)
   [post_modified_gmt] => (YYYY-MM-DD HH:MM:SS)
   [post_content_filtered] => (?)
   [post_parent]   => (integer)
   [guid]  => (a unique identifier that is not necessarily the URL to the Page)
   [menu_order]=> (integer)
   [post_type] => (? | page)
   [post_mime_type]=> ()?)
   [comment_count] => (integer)
   [ancestors] => (object|array)
   [filter]=> (? | raw)

ページへのリンクが必要な場合は、guid値を験して使用しないでください。代わりにthe_permalink あるいは get_permalinkを使用してください。

ページが見つからない場合は、null値が返されます。

このページは不完全としてマークされます。あなたはそれを展開するとCodexを助けることができます。

If you need the URL to the Page, don’t try and use the guid value. Use the_permalink or get_permalink instead.

If a page is not found, a null value is returned.

This page is marked as incomplete. You can help Codex by expanding it.

この例のコードはテーマ内に特定のページのテキストを含めたい時に使用することができます。

This example code can be used when you want to include the text of a specific page in a theme.

<?php 
$page_id = 123; // 123はサイトから特定のページのIDに置き換えてください、管理ページの管理ページでそのページを編集するリンクの上にマウスを載せることによって見つけることができます。idはURLのクエリー文字列に埋め込まれています。例:page.php?action=edit&amp;post=123
$page_data = get_page( $page_id ); // get_pageファンクションに変数を渡す必要があります。値(例:get_page ( 123 ); )に渡す場合、WordPressはエラーを生成します。 

$content = apply_filters('the_content', $page_data->post_content); // コンテンツを取得して、例えば段落タグなどWordPressフィルターを保持します。起源から: http://wordpress.org/support/topic/get_pagepost-and-no-paragraphs-problem
$title = $page_data->post_title; // タイトル取得します。
echo $content; // コンテンツを出力します。
?>
<?php 
$page_id = 123; // 123 should be replaced with a specific Page's id from your site, which you can find by mousing over the link to edit that Page on the Manage Pages admin page. The id will be embedded in the query string of the URL, e.g. page.php?action=edit&amp;post=123.
$page_data = get_page( $page_id ); // You must pass in a variable to the get_page function. If you pass in a value (e.g. get_page ( 123 ); ), WordPress will generate an error. 

$content = apply_filters('the_content', $page_data->post_content); // Get Content and retain WordPress filters such as paragraph tags. Origin from: http://wordpress.org/support/topic/get_pagepost-and-no-paragraphs-problem
$title = $page_data->post_title; // Get title
echo $content; // Output Content
?>

変更ログ

Since: 1.5.1

ソースファイル

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

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

関連ファンクションタグ

Page Tags: get_all_page_ids(), get_ancestors(), get_page(), get_page_link(), get_page_by_path(), get_page_by_title(), get_page_children(), get_page_hierarchy(), get_page_uri(), get_pages(), is_page(), page_uri_index(), wp_list_pages(), wp_page_menu() get_post

Sponsored Link