introducing empty parent template
This commit is contained in:
parent
25c65d376b
commit
3f072ca0b2
82
template-empty-parent.php
Normal file
82
template-empty-parent.php
Normal file
|
|
@ -0,0 +1,82 @@
|
||||||
|
<?php /* Template Name: Page Parente | Sans contenu */ ?>
|
||||||
|
<?php get_header(); ?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$currentThematique = get_the_terms(get_the_ID(), 'thematiques')[0];
|
||||||
|
$mainThematique = getMainThematique($currentThematique);
|
||||||
|
$thematiqueColorSlug = $mainThematique->slug;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
?>
|
||||||
|
|
||||||
|
<div class="homegrade-page-container <?php echo $thematiqueColorSlug ? "homegrade-page-container--" . $thematiqueColorSlug : "" ?>">
|
||||||
|
|
||||||
|
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||||
|
<?php
|
||||||
|
$currentPage = get_post();
|
||||||
|
$parentPage = $currentPage->post_parent !== 0 ? get_post($currentPage->post_parent) : null;
|
||||||
|
$grandParentPage = $parentPage->post_parent ? get_post($parentPage->post_parent) : null;
|
||||||
|
|
||||||
|
$args = array(
|
||||||
|
'posts_per_page' => -1,
|
||||||
|
'order' => 'ASC',
|
||||||
|
'post_parent' => $currentPage->ID,
|
||||||
|
'post_type' => 'page',
|
||||||
|
);
|
||||||
|
|
||||||
|
$childrenPages = get_children($args);
|
||||||
|
// echo '<pre>';
|
||||||
|
// print_r($childrens);
|
||||||
|
// echo '</pre>';
|
||||||
|
|
||||||
|
?>
|
||||||
|
<nav class=" breadcrumbs_navigation" aria-label="breadcrumbs">
|
||||||
|
<ol>
|
||||||
|
<li>
|
||||||
|
<a href="<?php echo home_url() ?>" title="<?php echo __("Accueil", "homegrade-theme__texte-fonctionnel") ?>">
|
||||||
|
<img src="<?php echo get_template_directory_uri() . "/resources/img/pictogrammes/icon_house_dark.svg" ?>" alt="">
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<?php if ($grandParentPage) : ?>
|
||||||
|
<li><a href="<?php echo get_post_permalink($grandParentPage) ?>"><?php echo $grandParentPage->post_title ?></a></li>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($parentPage) : ?>
|
||||||
|
<li><a href="<?php echo get_post_permalink($parentPage) ?>"><?php echo $parentPage->post_title ?></a></li>
|
||||||
|
<?php endif; ?>
|
||||||
|
<?php if ($currentPage) : ?>
|
||||||
|
<li><a href="<?php echo get_post_permalink($currentPage) ?>" aria-current="location"><?php echo $currentPage->post_title ?></a></li>
|
||||||
|
<?php endif; ?>
|
||||||
|
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
get_template_part("template-components/heading-box", null, array(
|
||||||
|
"pageIcon" => $pageIcon,
|
||||||
|
"title" => $currentPage->post_title,
|
||||||
|
"description" => the_excerpt(),
|
||||||
|
"coverIllustration" => get_field('page_illustration', $currentPage->ID),
|
||||||
|
));
|
||||||
|
?>
|
||||||
|
<?php foreach ($childrenPages as $subPage) : ?>
|
||||||
|
<?php
|
||||||
|
get_template_part("template-components/cards/page-card", null, array(
|
||||||
|
"title" => $subPage->post_title,
|
||||||
|
"excerpt" => get_the_excerpt($subPage->ID),
|
||||||
|
"permalink" => get_the_permalink($subPage->ID),
|
||||||
|
"coverIllustration" => get_field($subPage->ID),
|
||||||
|
));
|
||||||
|
?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php endforeach; ?>
|
||||||
|
|
||||||
|
|
||||||
|
<?php endwhile; ?>
|
||||||
|
|
||||||
|
<?php endif; ?>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php get_footer();
|
||||||
Loading…
Reference in New Issue
Block a user