introducing parcours-renovateur

This commit is contained in:
Antoine M 2024-04-16 16:00:39 +02:00
parent da45318a24
commit 7d83f3d2a9
4 changed files with 116 additions and 0 deletions

View File

@ -121,6 +121,7 @@
@import './pages/single-page.css';
@import './pages/single-conseils.css';
@import './pages/single-questions.css';
@import './pages/parcours-renovateur.css';
@import './pages/taxonomy-questions-(faq-per-taxonomy-term).css';
@import './pages/single-news.css';
@import './pages/404.css';

View File

@ -0,0 +1,7 @@
.parcours-steps-container {
@apply md:grid grid-cols-3 gap-12;
.step-container {
@apply bg-gray p-6 rounded-lg;
}
}

23
single-parcours.php Normal file
View File

@ -0,0 +1,23 @@
<?php
get_header();
?>
<?php if (have_posts()) : ?>
<?php
while (have_posts()) :
the_post();
$thematique = get_the_terms(get_the_ID(), 'thematiques')[0];
$thematiqueParent = getParentThematique($thematique);
$thematiqueColorSlug = getThematiqueFamilySlug($thematiqueParent->slug);
?>
<article class="container my-8 mx-auto entry-content single-editor-content <?php echo $thematiqueColorSlug ? "entry-content--" . $thematiqueColorSlug : "" ?>">
<?php the_content() ?>
</article>
<?php endwhile; ?>
<?php endif; ?>
<?php
get_footer();

View File

@ -0,0 +1,85 @@
<?php /* Template Name: Parcours rénovateur */ ?>
<?php get_header(); ?>
<?php
$currentThematique = get_the_terms(get_the_ID(), 'thematiques')[0];
$mainThematique = getMainThematique($currentThematique);
$thematiqueColorSlug = $mainThematique->slug;
$parcoursSteps = new WP_Query(array(
'post_type' => 'parcours',
'posts_per_page' => -1,
'order' => 'ASC',
'status' => 'publish',
'post_parent' => '0',
));
?>
<div class="homegrade-page-container <?php echo $thematiqueColorSlug ? "homegrade-page-container--" . $thematiqueColorSlug : "" ?>">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<nav class=" breadcrumbs_navigation" aria-label="<?php echo __("Vous êtes ici", "homegrade-theme__texte-fonctionnel") ?>">
<?php
$currentPage = get_post();
$parentPage = $currentPage->post_parent !== 0 ? get_post($currentPage->post_parent) : null;
$grandParentPage = $parentPage && $parentPage->post_parent ? get_post($parentPage->post_parent) : null;
?>
<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" aria-disabled="true"><?php echo $currentPage->post_title ?></a></li>
<?php endif; ?>
</ol>
</nav>
<h1><?php echo get_the_title() ?></h1>
<p><?php echo __("Toutes les étapes pour rénover votre logement ", "homegrade-theme__texte-fonctionnel") ?></p>
<section class="parcours-steps-container">
<?php foreach ($parcoursSteps->posts as $parcoursStep) : ?>
<div class="step-container">
<?php
$childrenStepPosts = get_posts(array(
'post_type' => 'parcours',
'posts_per_page' => -1,
'status' => 'publish',
'order' => 'menu_order',
'post_parent' => $parcoursStep->ID,
));
?>
<h2><?php echo $parcoursStep->post_title ?></h2>
<?php foreach ($childrenStepPosts as $childPost) : ?>
<p><?php echo $childPost->post_title ?></p>
<?php endforeach; ?>
</div>
<?php endforeach; ?>
</section>
<?php
the_content();
?>
<?php endwhile; ?>
<?php endif; ?>
</div>
<?php get_footer();