feature: Add new child pages block

This commit is contained in:
Keith Solomon
2025-09-26 13:32:58 -05:00
parent 06801182f5
commit 8ad0da9163
8 changed files with 781 additions and 2528 deletions

View File

@@ -59,6 +59,6 @@ jobs:
uses: wpengine/github-action-wpe-site-deploy@v3
with:
WPE_SSHG_KEY_PRIVATE: ${{ secrets.WPE_SSHG_KEY_PRIVATE }}
WPE_ENV: update-me
WPE_ENV: vdiv5
FLAGS: '-azvr --inplace --delete --exclude=".*"'
REMOTE_PATH: "wp-content/themes/update-me"
REMOTE_PATH: "wp-content/themes/vdiv5"

View File

@@ -323,7 +323,7 @@ class Breadcrumbs {
<a href="<?php echo esc_url( $item['url'] ); ?>">
<?php if ( $index === 0 ) : ?>
<svg class="flex-shrink-0 w-5 h-5" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" aria-label="Home">
<path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z" />
<path d="M10.707 2.293a1 1 0 00-1.414 0l-7 7a1 1 0 001.414 1.414L4 10.414V17a1 1 0 001 1h2a1 1 0 001-1v-2a1 1 0 011-1h2a1 1 0 011 1v2a1 1 0 001 1h2a1 1 0 001-1v-6.586l.293.293a1 1 0 001.414-1.414l-7-7z" />
</svg>
<span class="sr-only"><?php echo esc_attr( $item['label'] ); ?></span>
<?php else : ?>
@@ -340,7 +340,7 @@ class Breadcrumbs {
<?php if ( ! $isActive ) : ?>
<svg class="flex-shrink-0 w-5 h-5 text-light" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
<path fill-rule="evenodd" d="M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z" clip-rule="evenodd" />
</svg>
<?php endif; ?>
<?php endforeach; ?>

8
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{
"name": "basic-wp",
"version": "1.0.1",
"name": "vdi-starter-v5",
"version": "5.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "basic-wp",
"version": "1.0.1",
"name": "vdi-starter-v5",
"version": "5.0",
"license": "MIT",
"dependencies": {
"@tailwindcss/cli": "^4.0.13",

View File

@@ -1,5 +1,5 @@
/*
* Theme Name:
* Theme Name:VDI Starter v5
* Description: Custom WordPress theme starter for VDI Projects
* Version: 5.0
* Author: Vincent Design Inc.

View File

@@ -3,12 +3,13 @@
@import "../../static/dist/theme.css";
body {
font-family: 'Raleway', sans-serif;
font-family: 'Raleway', sans-serif;
&.wp-admin {
height: fit-content !important;
min-height: 100vh !important;
}
#wpwrap {
@layer utilities {
table.fixed { table-layout: fixed; position: static; }
}
}
}
#wpbody ul, ol, ul li, ol li { list-style-type: none; }

View File

@@ -2,8 +2,8 @@
@import "./global.css";
@import "./colors.css";
@import "./typography.css";
@import "./prose.css";
@import "./typography.css";
@import "./skip-link.css";
@import './misc.css';
@import "./forms.css";

File diff suppressed because it is too large Load Diff

View File

@@ -28,7 +28,7 @@ $children = get_posts(
);
// Set classes
$classes = 'page-children';
$classes = 'page-children container relative px-4 py-8 mx-auto sm:px-6 sm:py-12 lg:px-8';
// Set wrapper attributes
if ( ! $is_preview ) {
@@ -38,16 +38,96 @@ if ( ! $is_preview ) {
}
?>
<?php if ( ! empty( $currentPageChildren ) ) : ?>
<?php if ( ! empty( $children ) ) : ?>
<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>
<div class="grid grid-cols-1 gap-6 md:grid-cols-2">
<?php
foreach ( $children as $child ) {
// Grandchildren of *this child* only
$grandchildren = get_posts(
array(
'post_type' => 'page',
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => array(
'menu_order' => 'ASC',
'title' => 'ASC',
),
'order' => 'ASC',
'post_parent' => $child->ID, // fixed depth: 2 levels total
'fields' => 'all',
'no_found_rows' => true,
)
);
if ( count( $grandchildren ) > 0 ) {
$gcHeight = 'max-h-[300px]';
$gcPad = '';
$lnkArrow = '';
} else {
$gcHeight = '';
$gcPad = 'pb-4';
$lnkArrow = 'icon-chevron-right-after';
}
$imgChild = ( get_the_post_thumbnail_url( $child->ID, 'medium_large' ) ) ? get_the_post_thumbnail_url( $child->ID, 'medium_large' ) : 'https://picsum.photos/seed/' . $child->ID . '/400/300?';
?>
<article class="flex flex-col lg:flex-row overflow-hidden border-2 rounded-lg shadow-lg card border-primary-100 group <?php echo esc_attr( $gcHeight ); ?>">
<div class="max-w-[40%]">
<img src="<?php echo esc_attr( $imgChild ); ?>" alt="<?php echo esc_attr( get_the_title( $child ) ); ?>" class="object-cover w-full h-full p-0 m-0 transition-transform duration-300 ease-in-out transform group-hover:scale-105">
</div>
<div class="flex flex-col justify-start items-start flex-1 h-full p-6">
<div class="w-full">
<h3 class="mt-0 mb-3 font-semibold text-gray-800 transition text-25px w-full text-left">
<?php
if ( empty( $grandchildren ) ) {
?>
<a href="<?php echo esc_url( get_permalink( $child->ID ) ); ?>" class="block w-full card-link reset text-secondary hover:opacity-80 <?php echo esc_attr( $lnkArrow ); ?>">
<?php echo wp_kses_post( $child->post_title ); ?>
</a>
<?php } else { ?>
<?php echo wp_kses_post( $child->post_title ); ?>
<?php } ?>
</h3>
</div>
<div class="my-0 grow-1 text-18px text-gray-600 <?php echo esc_attr( $gcPad ); ?>">
<?php
if ( ! empty( $grandchildren ) ) {
?>
<ul class="p-0 m-0 mt-2 ml-4 list-outside text-16px marker:text-gray-500">
<?php
foreach ( $grandchildren as $grandchild ) {
?>
<li class="p-0 m-0 mb-2 leading-tight">
<a class="hover:underline text-secondary" href="<?php echo esc_url( get_permalink( $grandchild->ID ) ); ?>">
<?php echo wp_kses_post( get_the_title( $grandchild ) ); ?>
</a>
</li>
<?php
}
?>
</ul>
<?php
} else {
$firstParagraph = '';
if ( $child->post_content ) {
preg_match( '/<p>(.*?)<\/p>/i', apply_filters( 'the_content', $child->post_content ), $matches );
$firstParagraph = $matches[1] ?? '';
}
?>
<div class="leading-snug line-clamp-4">
<?php echo wp_kses_post( $firstParagraph ); ?>
</div>
<?php
}
?>
</div>
</div>
</article>
<?php } ?>
</div>
</section>
<?php endif; ?>