get_page_children

Sponsored Link

ページIDに一致するページのリストから子ページを取得します。

ページIDに対してページパラメーターとの照合します。また、ページの全ての子を取得するために同一のための全ての子を一致します。子を取得するために任意のSQLクエリーを作成しません。

Sponsored Link

Retrieve child pages from list of pages matching page ID.

Matches against the pages parameter against the page ID. Also matches all children for the same to retrieve all children of a page. Does not make any SQL queries to get the children.

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

<?php &amp;get_page_children( $page_id, $pages ) ?>
<?php get_page_children( $page_id, $pages ) ?>

get_page_childrenのパラメーター

$page_id

(integer) (required) ページIDです。
デフォルト:なし

(integer) (required) Page ID.
Default: None

$pages

(array) (required) ページのオブジェクトのリストです。
デフォルト:なし

(array) (required) List of pages’ objects.
Default: None

戻り値

(array)

<?php
// 必要なオブジェクトを設定するSet up the objects needed
$my_wp_query = new WP_Query();
$all_wp_pages = $my_wp_query->query(array('post_type' => 'page'));

// オブジェクトとしてページを取得します。Get the page as an Object
$portfolio =  get_page_by_title('Portfolio');

// 全てのページを介してPortfolioの子を見つけるフィルターです。Filter through all pages and find Portfolio's children
$portfolio_children = get_page_children($portfolio->ID, $all_wp_pages);

// WPからブラウザーに戻って何をechoするか。echo what we get back from WP to the browser
echo '<pre>'.print_r($portfolio_children,true).'</pre>';
?>

注釈

この関数は再帰的にそれ自身を呼び出します。

This function calls itself recursively.

変更ログ

Since: 1.5.1

ソースファイル

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

get_page_children() 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()

Sponsored Link