handling building chapters

This commit is contained in:
Antoine M 2024-07-01 15:43:05 +02:00
parent c57de6a332
commit e01315b972

View File

@ -19,8 +19,10 @@ $otherSteps = new WP_Query(array(
'post__not_in' => array(get_queried_object_id())
));
?>
$blocks = parse_blocks($post->post_content);
$chapterBlockIndex = build_page_chapter_index($blocks); // see utilities.php
?>
@ -42,19 +44,35 @@ $otherSteps = new WP_Query(array(
</nav>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$pageIcon = get_field('page_icon', $archiveParcours->ID);
get_template_part("template-components/heading-box--parcours", null, array(
<?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">
<aside>
<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) : ?>
@ -89,7 +107,7 @@ $otherSteps = new WP_Query(array(
</a>
<?php endforeach; ?>
</div>
</aside>
</aside> -->
<article class="container my-8 mx-auto entry-content single-editor-content">
@ -109,6 +127,4 @@ $otherSteps = new WP_Query(array(
<?php endforeach; ?> -->
</article>
</div>
<?php endwhile; ?>
<?php endif; ?>
</div>