Initial commit to github

This commit is contained in:
Keith Solomon
2025-08-22 15:40:01 -05:00
commit e8efdbeb34
230 changed files with 32213 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
{
"name": "acf/page-children",
"title": "Page Children",
"description": "Block to display children of curent page.",
"style": [
"file:./page-children.css"
],
"category": "vdi-block",
"icon": "block-default",
"keywords": [
"page-children"
],
"acf": {
"mode": "preview",
"renderTemplate": "page-children.php"
},
"supports": {
"align": false,
"anchor": false,
"color": false,
"html": false,
"jsx": false,
"mode": false,
"multiple": false
}
}

View File

@@ -0,0 +1,37 @@
<?php
/**
* Page Children block
*
* @package BasicWP
*/
namespace BasicWP;
// Retrieve the current page ID and its children
$currentPageId = get_the_ID();
$currentPageChildren = get_pages( array( 'child_of' => $currentPageId ) );
// Set classes
$classes = 'page-children';
// Set wrapper attributes
if ( ! $is_preview ) {
$wrapper = get_block_wrapper_attributes( array( 'class' => $classes ) );
} else {
$wrapper = 'class="' . $classes . '"';
}
?>
<?php if ( ! empty( $currentPageChildren ) ) : ?>
<section id="page-children" <?php echo wp_kses_post( $wrapper ); ?>>
<ul>
<?php foreach ( $currentPageChildren as $child ) : ?>
<li class="page-child">
<a href="<?php echo esc_url( get_permalink( $child->ID ) ); ?>">
<?php echo esc_html( $child->post_title ); ?>
</a>
</li>
<?php endforeach; ?>
</ul>
</section>
<?php endif; ?>