🔵 other: Start page children block upgrade
This commit is contained in:
@@ -1,26 +1,26 @@
|
|||||||
{
|
{
|
||||||
"name": "acf/page-children",
|
"name": "acf/page-children",
|
||||||
"title": "Page Children",
|
"title": "Page Children",
|
||||||
"description": "Block to display children of curent page.",
|
"description": "Block to display children of curent page.",
|
||||||
"style": [
|
"style": [
|
||||||
"file:./page-children.css"
|
"file:./page-children.css"
|
||||||
],
|
],
|
||||||
"category": "vdi-block",
|
"category": "vdi-block",
|
||||||
"icon": "block-default",
|
"icon": "block-default",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"page-children"
|
"page-children"
|
||||||
],
|
],
|
||||||
"acf": {
|
"acf": {
|
||||||
"mode": "preview",
|
"mode": "preview",
|
||||||
"renderTemplate": "page-children.php"
|
"renderTemplate": "page-children.php"
|
||||||
},
|
},
|
||||||
"supports": {
|
"supports": {
|
||||||
"align": false,
|
"align": false,
|
||||||
"anchor": false,
|
"anchor": false,
|
||||||
"color": false,
|
"color": false,
|
||||||
"html": false,
|
"html": false,
|
||||||
"jsx": false,
|
"jsx": false,
|
||||||
"mode": false,
|
"mode": false,
|
||||||
"multiple": false
|
"multiple": false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,8 +8,24 @@
|
|||||||
namespace BasicWP;
|
namespace BasicWP;
|
||||||
|
|
||||||
// Retrieve the current page ID and its children
|
// Retrieve the current page ID and its children
|
||||||
$currentPageId = get_the_ID();
|
$parentId = get_queried_object_id();
|
||||||
$currentPageChildren = get_pages( array( 'child_of' => $currentPageId ) );
|
|
||||||
|
// Children: direct descendants only
|
||||||
|
$children = get_posts(
|
||||||
|
array(
|
||||||
|
'post_type' => 'page',
|
||||||
|
'post_status' => 'publish',
|
||||||
|
'posts_per_page' => -1,
|
||||||
|
'orderby' => array(
|
||||||
|
'menu_order' => 'ASC',
|
||||||
|
'title' => 'ASC',
|
||||||
|
),
|
||||||
|
'order' => 'ASC',
|
||||||
|
'post_parent' => $parentId,
|
||||||
|
'fields' => 'all',
|
||||||
|
'no_found_rows' => true,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
// Set classes
|
// Set classes
|
||||||
$classes = 'page-children';
|
$classes = 'page-children';
|
||||||
|
|||||||
Reference in New Issue
Block a user