homegrade_theme_production/single-parcours-parent.php

130 lines
4.5 KiB
PHP

<?php
$chapters = new WP_Query(array(
'post_type' => 'parcours',
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
'status' => 'publish',
'post_parent' => get_queried_object_id(),
));
$otherSteps = new WP_Query(array(
'post_type' => 'parcours',
'posts_per_page' => -1,
'orderby' => 'menu_order',
'order' => 'ASC',
'status' => 'publish',
'post_parent' => 0,
'post__not_in' => array(get_queried_object_id())
));
$blocks = parse_blocks($post->post_content);
$chapterBlockIndex = build_page_chapter_index($blocks); // see utilities.php
?>
<nav class=" breadcrumbs_navigation" aria-label="<?php echo __("Vous êtes ici", "homegrade-theme__texte-fonctionnel") ?>">
<?php
$archiveParcours = get_page_by_template('template-parcours-renovateur.php')[0];
?>
<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>
<li><a href="<?php echo get_post_permalink($archiveParcours) ?>"><?php echo $archiveParcours->post_title ?></a></li>
<li><a href="<?php echo the_permalink() ?>" aria-current="location" aria-disabled="true"><?php echo get_queried_object()->post_title ?></a></li>
</ol>
</nav>
<?php
$pageIcon = get_field('page_icon', $archiveParcours->ID);
get_template_part("template-components/heading-box--parcours", null, array(
"pageIcon" => $pageIcon,
"subtitle" => __("Parcours rénovateur", "homegrade-theme__texte-fonctionnel"),
"title" => get_the_title(),
"icon" => $pageIcon,
));
?>
<div class="parcours-content-wrapper conseils_wrapper">
<!-- CHAPTER INDEX -->
<aside class="chapter_index">
<?php if ($chapterBlockIndex) : ?>
<div class="chapter_index__titling">
<div class="icon">
<img src="<?php echo get_template_directory_uri() . '/resources/img/graphic-assets/icon-feather-menu.svg' ?>" alt="">
</div>
<h2 class="chapter_index__title"> <?php echo __("Dans ce conseil", "homegrade-theme__texte-fonctionnel") ?> </h2>
</div>
<ul class="chapter_index__list">
<div class="chapter_index__position-indicator"></div>
<?php foreach ($chapterBlockIndex as $chapter) : ?>
<li class="chapter_index__link"><a href="<?php echo $chapter['anchor'] ?>"><?php echo $chapter['title'] ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</aside>
<!-- <aside>
<div class="parcours-steps">
<div class="current-steps-index">
<?php if ($chapters->posts) : ?>
<div class="chapter_index__titling">
<div class="icon">
<img src="<?php echo get_template_directory_uri() . '/resources/img/graphic-assets/icon-feather-menu.svg' ?>" alt="">
</div>
<h2 class="chapter_index__title"> <?php echo __("Dans ce parcours", "homegrade-theme__texte-fonctionnel") ?> </h2>
</div>
<ul class="chapter_index__list">
<div class="chapter_index__position-indicator"></div>
<?php foreach ($chapters->posts as $chapter) : ?>
<?php
$shortTitle = get_field('short_title', $chapter->ID);
?>
<li class="chapter_index__link"><a href="#<?php echo $chapter->post_name ?>"><?php echo $chapter->post_title ?></a></li>
<?php endforeach; ?>
</ul>
<?php endif; ?>
</div>
<?php foreach ($otherSteps->posts as $otherStep) : ?>
<a class="parcours-other-steps-suggestion" href="<?php echo get_the_permalink($otherStep->ID) ?>">
<?php
$stepIcon = get_field('step_icon', $otherStep->ID);
?>
<?php if ($stepIcon) : ?>
<img class="step-icon" src="<?php echo $stepIcon['url'] ?>" alt="">
<?php endif; ?>
<span><?php echo $otherStep->post_title ?></span>
</a>
<?php endforeach; ?>
</div>
</aside> -->
<article class="container my-8 mx-auto entry-content single-editor-content">
<?php
the_content();
?>
<!-- <?php foreach ($chapters->posts as $chapter) : ?>
<?php if ($chapter->post_content) : ?>
<div id="<?php echo $chapter->post_name ?>" class="parcours-chapter-container">
<h2><?php echo $chapter->post_title ?></h2>
<img src="" alt="">
<?php echo $chapter->post_content ?>
<a href="<?php echo get_post_permalink($chapter->ID) ?>">Voir la single <?php echo $chapter->post_title ?></a>
</div>
<?php endif; ?>
<?php endforeach; ?> -->
</article>
</div>