refining page empty parent

This commit is contained in:
Antoine M 2023-11-29 18:48:42 +01:00
parent 117bb39c44
commit 2a70b7ba43
2 changed files with 22 additions and 13 deletions

View File

@ -0,0 +1,5 @@
.template-empty-parent {
.page-cards {
@apply mt-12 mb-20;
}
}

View File

@ -11,7 +11,7 @@ $thematiqueColorSlug = $mainThematique->slug;
?> ?>
<div class="homegrade-page-container <?php echo $thematiqueColorSlug ? "homegrade-page-container--" . $thematiqueColorSlug : "" ?>"> <div class="homegrade-page-container template-empty-parent">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php <?php
@ -24,6 +24,7 @@ $thematiqueColorSlug = $mainThematique->slug;
'order' => 'ASC', 'order' => 'ASC',
'post_parent' => $currentPage->ID, 'post_parent' => $currentPage->ID,
'post_type' => 'page', 'post_type' => 'page',
'status' => 'publish',
); );
$childrenPages = get_children($args); $childrenPages = get_children($args);
@ -52,26 +53,29 @@ $thematiqueColorSlug = $mainThematique->slug;
</ol> </ol>
</nav> </nav>
<?php <?php
get_template_part("template-components/heading-box", null, array( get_template_part("template-components/heading-box", null, array(
"pageIcon" => $pageIcon, "pageIcon" => $pageIcon,
"title" => $currentPage->post_title, "title" => $currentPage->post_title,
"description" => the_excerpt(), "description" => get_the_excerpt(),
"coverIllustration" => get_field('page_illustration', $currentPage->ID), "pageIcon" => get_field('page_icon', $currentPage->ID),
)); ));
?> ?>
<div class="page-cards">
<?php foreach ($childrenPages as $subPage) : ?> <?php foreach ($childrenPages as $subPage) : ?>
<?php <?php
get_template_part("template-components/cards/page-card", null, array( get_template_part("template-components/cards/page-card", null, array(
"title" => $subPage->post_title, "title" => $subPage->post_title,
"excerpt" => get_the_excerpt($subPage->ID), "excerpt" => get_the_excerpt($subPage->ID),
"permalink" => get_the_permalink($subPage->ID), "permalink" => get_the_permalink($subPage->ID),
"coverIllustration" => get_field($subPage->ID), "coverIllustration" => get_field("page_illustration", $subPage->ID),
)); ));
?> ?>
<?php endforeach; ?> <?php endforeach; ?>
</div>
<?php endwhile; ?> <?php endwhile; ?>