تابع ووکامرسی wc_get_page_children دریافت صفحه فرزند ( زیر مجموعه )

تابع ووکامرسی wc_get_page_children – دریافت و نمایش صفحه فرزند ( زیر مجموعه )
Syntax – سینتکس
(int[]) wc_get_page_children( (int) $page_id );
Parameters – پارامتر ها (1)
- 1- $page_id (int)
Usage – نحوه استفاده
if ( !function_exists( 'wc_get_page_children' ) ) {
require_once ABSPATH . PLUGINDIR . 'woocommerce/includes/wc-core-functions.php';
}
// The page id.
$page_id = -1;
// NOTICE! Understand what this does before running.
$result = wc_get_page_children($page_id);
Defined – محل تعریف
/includes/wc-core-functions.php
function wc_get_page_children( $page_id ) {
$page_ids = get_posts( array(
'post_parent' => $page_id,
'post_type' => 'page',
'numberposts' => -1,
'post_status' => 'any',
'fields' => 'ids',
) );
if ( ! empty( $page_ids ) ) {
foreach ( $page_ids as $page_id ) {
$page_ids = array_merge( $page_ids, wc_get_page_children( $page_id ) );
}
}
return $page_ids;
}
versions – نسخه ها
از نسخه : 3.0.2
نسخه فعلی : 3.0.6
دیگر نسخه ها : 3.0.6 , 3.0.5 , 3.0.4 , 3.0.3 , 3.0.2
ارسال نظر