homegrade_theme_production/taxonomy-thematiques.php

120 lines
3.5 KiB
PHP

<?php
/************/
/* PAGE FAQ */
/************/
?>
<?php get_header(); ?>
<?php
$currentThematique = get_queried_object();
$mainThematique = getMainThematique($currentThematique);
$thematiqueColorSlug = getThematiqueFamilySlug($mainThematique->slug);
$sousThematiques = get_terms(array(
'child_of' => $mainThematique->term_id,
'taxonomy' => 'thematiques',
'hide_empty' => true,
));
?>
<nav class="breadcrumbs_navigation" aria-label="breadcrumbs">
<?php
$current_children_thematique = get_queried_object()->parent != 0 ? get_queried_object() : null;
$archiveQuestions = get_page_by_template('template-archive-questions.php')[0];
?>
<ol>
<li><a href="<?php echo home_url() ?>">Home</a></li>
<li><a href="<?php echo get_post_permalink($archiveQuestions) ?>"><?php echo $archiveQuestions->post_title ?></a></li>
<li>
<a href="<?php echo get_term_link($mainThematique) ?>" aria-current='location'><?php echo $mainThematique->name ?></a>
</li>
<?php if ($current_children_thematique) : ?>
<li>
<a href="<?php echo get_term_link($current_children_thematique) ?>"><?php echo $current_children_thematique->name ?></a>
</li>
<?php endif; ?>
</ol>
</nav>
<div class="post-question-page <?php echo $thematiqueColorSlug ? "post-question-page--" . $mainThematique->slug : "" ?>"">
<?php get_template_part(
'template-components/posts-components/chapter-header',
null,
array(
'ID' => get_queried_object_id(),
'title' => __("Les questions les plus fréquentes sur ", "homegrade-theme__texte-fonctionnel__faq-archive-questions") . get_queried_object()->name,
'sub-title' => $currentThematique->name,
'thematique' => $currentThematique,
'thematique_generale' => $mainThematique,
'thematiqueColorSlug' => $thematiqueColorSlug,
)
); ?>
<section class=" post-question-page__accordeons-container ">
<?php if ($mainThematique && $sousThematiques) : ?>
<div class=" thematiques_filters">
<h3><?php echo __("Filtrer par catégories", $theme_namespace) ?></h3>
<ul class="thematiques_filters__list">
<?php foreach ($sousThematiques as $sousThematique) : ?>
<li data-filter="<?php echo $sousThematique->slug ?>">
<input type="checkbox" title="<?php echo $sousThematique->name ?>" name="veggy01" id="veggy01" />
<label for="veggy01"><?php echo $sousThematique->name ?></label></p>
<!-- <div role="checkbox" aria-checked="false" tabindex="0"><?php echo $sousThematique->name ?></div> -->
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<?php
$query_args = array(
'post_type' => 'questions',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'thematiques',
'field' => 'term_id',
'terms' => $mainThematique->term_id,
)
)
);
$relatedTaxQuestions = new WP_Query($query_args);
?>
<h2 aria-live=" polite"><?php echo __("Nombre de résultats", 'homegrade-theme__texte-fonctionnel') . " : " . count($relatedTaxQuestions->posts) ?></h2>
<?php if ($relatedTaxQuestions->have_posts()) : while ($relatedTaxQuestions->have_posts()) : $relatedTaxQuestions->the_post(); ?>
<details class=" question">
<summary>
<?php the_title(); ?>
<div class="open-close-icon">
<img src="<?php echo get_template_directory_uri() . '/resources/img/graphic-assets/chevron_down.svg' ?>" class="open-close-cta" alt="" />
</div>
</summary>
<div class="content entry-content">
<?php the_content(); ?>
</div>
</details>
<?php endwhile ?>
<?php endif; ?>
</section>
</div>
<?php
get_footer();