170 lines
5.6 KiB
PHP
170 lines
5.6 KiB
PHP
<?php
|
|
|
|
/************/
|
|
/* PAGE FAQ */
|
|
/************/
|
|
?>
|
|
<?php get_header(); ?>
|
|
|
|
|
|
<?php
|
|
$currentThematique = get_queried_object();
|
|
$currentThematiqueIsParent = $currentThematique->parent === 0;
|
|
$mainThematique = getMainThematique($currentThematique);
|
|
$thematiqueColorSlug = getThematiqueFamilySlug($mainThematique->slug);
|
|
|
|
$sousThematiques = get_terms(array(
|
|
'child_of' => $mainThematique->term_id,
|
|
'taxonomy' => 'thematiques',
|
|
'hide_empty' => true,
|
|
));
|
|
?>
|
|
|
|
|
|
<?php
|
|
$query_args = array(
|
|
'post_type' => 'questions',
|
|
'posts_per_page' => -1,
|
|
'status' => 'publish',
|
|
'tax_query' => array(
|
|
array(
|
|
'taxonomy' => 'thematiques',
|
|
'field' => 'term_id',
|
|
'terms' => $currentThematique->term_id,
|
|
)
|
|
)
|
|
);
|
|
$relatedTaxQuestions = new WP_Query($query_args);
|
|
?>
|
|
|
|
<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() ?>" 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($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-container <?php echo $thematiqueColorSlug ? "post-question-page--" . $mainThematique->slug : "" ?>"" data-thematique-id=" <?php echo $currentThematique->term_id ?>">
|
|
|
|
<?php get_template_part(
|
|
'template-components/posts-components/chapter-header',
|
|
null,
|
|
array(
|
|
'ID' => get_queried_object_id(),
|
|
'title' => __("Les questions les plus fréquentes", "homegrade-theme__texte-fonctionnel__faq-archive-questions"),
|
|
'sub-title' => $currentThematique->name,
|
|
'thematique' => $currentThematique,
|
|
'thematique_generale' => $mainThematique,
|
|
'thematiqueColorSlug' => $thematiqueColorSlug,
|
|
)
|
|
|
|
); ?>
|
|
<section class=" post-question-page__accordeons-container ">
|
|
<?php if ($mainThematique && $sousThematiques) : ?>
|
|
<?php
|
|
|
|
?>
|
|
<!-- <div class=" thematiques_filters">
|
|
|
|
<nav class="thematiques-subtaxonomy-links" aria-label="breadcrumbs">
|
|
<h3><?php echo __("Filtrer par catégories", "homegrade-theme__texte-fonctionnel") ?></h3>
|
|
<ul>
|
|
<?php foreach ($sousThematiques as $sousThematique) : ?>
|
|
<li data-filter="<?php echo $sousThematique->slug ?>">
|
|
<button class="cta cta--outline cta--button text-<?php echo $sousThematique->slug ?>"><?php echo $sousThematique->name ?></button>
|
|
</li>
|
|
<?php endforeach; ?>
|
|
</ul>
|
|
<h2 aria-live=" polite"><?php echo __("Nombre de résultats", 'homegrade-theme__texte-fonctionnel') . " : " . count($relatedTaxQuestions->posts) ?></h2>
|
|
</nav>
|
|
|
|
</div> -->
|
|
<?php endif; ?>
|
|
|
|
|
|
<?php if ($relatedTaxQuestions->have_posts()) : while ($relatedTaxQuestions->have_posts()) : $relatedTaxQuestions->the_post(); ?>
|
|
<?php
|
|
|
|
$questionCurrentSubthematique = get_the_terms(get_the_ID(), 'thematiques')[0] ?? null;
|
|
$relatedFichesConseilsSubThematiqueQuery = new WP_Query(array(
|
|
'post_type' => 'conseils',
|
|
'posts_per_page' => 1,
|
|
'tax_query' => array(
|
|
array(
|
|
'taxonomy' => 'thematiques',
|
|
'field' => 'term_id',
|
|
'terms' => $questionCurrentSubthematique->term_id,
|
|
)
|
|
)
|
|
));
|
|
$relatedFichesConseilsThematiqueQuery = new WP_Query(array(
|
|
'post_type' => 'conseils',
|
|
'posts_per_page' => 1,
|
|
'tax_query' => array(
|
|
array(
|
|
'taxonomy' => 'thematiques',
|
|
'field' => 'term_id',
|
|
'terms' => $mainThematique->term_id,
|
|
)
|
|
)
|
|
));
|
|
$relatedFicheConseil = $relatedFichesConseilsSubThematiqueQuery->posts[0] ?? $relatedFichesConseilsThematiqueQuery->posts[0] ?? null;
|
|
|
|
// $test = $relatedSubThematiqueQuery->posts[0] ??
|
|
echo '<pre>';
|
|
// print_r($questionCurrentSubthematique);
|
|
// print_r($relatedFichesConseilsSubThematiqueQuery->posts[0]->ID);
|
|
// print_r($relatedSubThematiqueConseil->posts[0]->ID);
|
|
echo '</pre>';
|
|
|
|
?>
|
|
<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(); ?>
|
|
<?php if ($relatedFicheConseil) : ?>
|
|
<div class="question-context">
|
|
<p class="question-context__title"><?php echo __("Ce contenu fait parti de ", "homegrade-theme__texte-fonctionnel") ?></p>
|
|
<a class="question-context__conseil-name" href="<?php echo get_permalink($relatedFicheConseil) ?>">
|
|
<?php echo $relatedFicheConseil->post_title ?>
|
|
</a>
|
|
</div>
|
|
<?php endif; ?>
|
|
</div>
|
|
</details>
|
|
|
|
<?php endwhile ?>
|
|
<?php endif; ?>
|
|
</section>
|
|
<!-- <button id="load-more-questions"><?php echo __("Charger plus de questions", "homegrade-theme__texte-fonctionnel") ?></button> -->
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<?php
|
|
get_footer();
|