working on parcours singles data loop

This commit is contained in:
Antoine M 2024-07-11 10:50:41 +02:00
parent 73cc99a57d
commit b0ae50409d
2 changed files with 72 additions and 5 deletions

View File

@ -1,8 +1,75 @@
<?php <?php
$parentTitle = get_the_title($post->post_parent) ?? null;
$parentUrl = get_the_permalink($post->post_parent) ?? null;
$pageIcon = get_field('step_icon', $post->ID);
?> ?>
<article class="container my-8 mx-auto entry-content single-editor-content <?php echo $thematiqueColorSlug ? "entry-content--" . $thematiqueColorSlug : "" ?>"> <div class="post-parcours-page-container">
<?php the_content() ?> <nav class=" breadcrumbs_navigation" aria-label="<?php echo __("Vous êtes ici", "homegrade-theme__texte-fonctionnel") ?>">
</article> <?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 $parentUrl ?>"><?php echo $parentTitle ?></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 /* --------
HEADING BOX
---------------*/ ?>
<?php
get_template_part("template-components/heading-box--parcours-single", null, array(
"parent_title" => $parentTitle,
"title" => get_the_title(),
"page_icon" => $pageIcon,
"published" => get_the_date()
));
?>
<article class="container my-8 mx-auto entry-content single-editor-content <?php echo $thematiqueColorSlug ? "entry-content--" . $thematiqueColorSlug : "" ?>">
<?php the_content() ?>
</article>
<!-- PREVIOUS / NEXT ARTICLES -->
<div class="previous-next-posts">
<?php
$prev_post = get_previous_post() ?? null;
$next_post = get_next_post() ?? null;
$prev_thumbnail_url = get_the_post_thumbnail_url($prev_post, 'thumbnail');
$prev_page_icon = get_field('step_icon', $prev_post->ID) ?? null;
$next_page_icon = get_field('step_icon', $next_post->ID) ?? null;
?>
<?php if ($next_post) : ?>
<a class="previous-next-parcours__next" href="<?php echo get_the_permalink($next_post->ID) ?>">
<div class="previous-next-parcours__link-content">
<p class="post_denomination"><?php echo __("Étape suivante ", "homegrade-theme__texte-fonctionnel") ?></p>
<p class="post_title"><?php echo $next_post->post_title ?></p>
</div>
<img class="page_icon" src="<?php echo $next_page_icon['url'] ?>" alt="">
</a>
<?php endif; ?>
<?php if ($prev_post) : ?>
<a class="previous-next-parcours__previous" href="<?php echo get_the_permalink($prev_post->ID) ?>">
<img class="page_icon" src="<?php echo $prev_page_icon['url'] ?>" alt="">
<div class="previous-next-parcours__link-content">
<p class="post_denomination"><?php echo __("Étape précédente ", "homegrade-theme__texte-fonctionnel") ?></p>
<p class="post_title"><?php echo $prev_post->post_title ?></p>
</div>
</a>
<?php endif; ?>
</div>
</div>

View File

@ -42,7 +42,7 @@ $chapterBlockIndex = build_page_chapter_index($blocks); // see utilities.php
<?php <?php
$pageIcon = get_field('page_icon', $archiveParcours->ID); $pageIcon = get_field('page_icon', $archiveParcours->ID);
get_template_part("template-components/heading-box--parcours", null, array( get_template_part("template-components/heading-box--parcours-parent", null, array(
"pageIcon" => $pageIcon, "pageIcon" => $pageIcon,
"subtitle" => __("Parcours rénovateur", "homegrade-theme__texte-fonctionnel"), "subtitle" => __("Parcours rénovateur", "homegrade-theme__texte-fonctionnel"),
"title" => get_the_title(), "title" => get_the_title(),