61 lines
2.0 KiB
PHP
61 lines
2.0 KiB
PHP
<?php
|
|
$relatedTaxQuestions = $args['relatedTaxQuestions'] ?? null
|
|
?>
|
|
|
|
<?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;
|
|
|
|
|
|
?>
|
|
<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; ?>
|
|
|
|
|
|
<?php if (!$relatedTaxQuestions->have_posts()) : ?>
|
|
<p class="filters-no-results"><?php echo __("Pas de résultats pour cette recherche", "homegrade-theme__texte-fonctionnel") ?></p>
|
|
<?php endif; ?>
|