refactoring and developping single-question faq page templates

This commit is contained in:
Antoine M 2023-10-12 17:09:52 +02:00
parent cbb01874ad
commit 487fee420e
5 changed files with 71 additions and 29 deletions

View File

@ -70,6 +70,6 @@
@import './pages/demo-components.css';
@import './pages/template-archive-publications.css';
@import './pages/template-archive-conseils.css';
@import './pages/template-archive-questions.css';
@import './pages/template-archive-questions-(faq).css';
@import './pages/single-conseils.css';
@import './pages/questions-thematiques-(faq).css';
@import './pages/single-questions-(taxonomy-term).css';

View File

@ -52,6 +52,10 @@ body.acoustique,
.homegrade-blocks-lien-chapitre__cta:hover {
@apply filter-acoustique-coproprietes;
}
/* page single questions */
.thematiques-subtaxonomy-links .cta {
@apply text-acoustique-coproprietes border-acoustique-coproprietes;
}
}
/* PETITES COPROPRIÉTÉS — SPECIFIC */
@ -129,6 +133,10 @@ body.energies,
.homegrade-blocks-focused-thematique__figcaption-toggle img {
@apply filter-energies-urbanisme;
}
/* page single questions */
.thematiques-subtaxonomy-links .cta {
@apply text-energies-urbanisme border-energies-urbanisme;
}
}
/* URBANISME — SPECIFIC */
@ -205,6 +213,10 @@ body.isolation,
.homegrade-blocks-focused-thematique__figcaption-toggle img {
@apply filter-isolation-quotidien;
}
/* page single questions */
.thematiques-subtaxonomy-links .cta {
@apply text-isolation-quotidien border-isolation-quotidien;
}
}
/* AU QUOTIDIEN — SPECIFIC */
@ -278,6 +290,11 @@ body.patrimoine,
.homegrade-blocks-focused-thematique__figcaption-toggle img {
@apply filter-patrimoine-renovation;
}
/* page single questions */
.thematiques-subtaxonomy-links .cta {
@apply text-patrimoine-renovation border-patrimoine-renovation;
}
}
body.renovation,
@ -351,6 +368,11 @@ body.renovation-circulaire,
.homegrade-blocks-focused-thematique__figcaption-toggle img {
@apply filter-patrimoine-renovation;
}
/* page single questions */
.thematiques-subtaxonomy-links .cta {
@apply text-location-renovation-circulaire border-location-renovation-circulaire;
}
}
/* RENOVATION CIRCULAIRE — SPECIFIC */

View File

@ -1,4 +1,19 @@
.post-question-page {
.thematiques-subtaxonomy-links {
@apply pb-12;
ul {
@apply flex flex-wrap gap-2;
.cta--button {
@apply px-4 py-2;
}
.cta--button:not([aria-current='location']) {
/* filter: grayscale(1) opacity(0.8); */
@apply text-gray-dark border-gray-dark;
}
}
}
ul.checkboxes {
list-style: none;
margin: 0;

View File

@ -1,3 +1,4 @@
.card-large-content-container {
@apply pt-40 mt-12 mb-0;

View File

@ -9,8 +9,10 @@
<?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',
@ -19,6 +21,20 @@ $sousThematiques = get_terms(array(
?>
<?php
$query_args = array(
'post_type' => 'questions',
'posts_per_page' => -1,
'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
@ -59,39 +75,23 @@ $sousThematiques = get_terms(array(
<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>
<nav class="thematiques-subtaxonomy-links" aria-label="breadcrumbs">
<h3><?php echo __("Filtrer par catégories", $theme_namespace) ?></h3>
<ul>
<?php foreach ($sousThematiques as $sousThematique) : ?>
<li data-filter="<?php echo $sousThematique->slug ?>">
<a class="cta cta--outline cta--button text-<?php echo $currentThematique->slug ?>" href="<?php echo get_term_link($sousThematique) ?>" <?php echo $sousThematique == get_queried_object() ? "aria-current='location'" : "" ?>><?php echo $sousThematique->name ?></a>
</li>
<?php endforeach; ?>
</ul>
<h2 aria-live=" polite"><?php echo __("Nombre de résultats", 'homegrade-theme__texte-fonctionnel') . " : " . count($relatedTaxQuestions->posts) ?></h2>
</nav>
<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">
@ -108,6 +108,10 @@ $relatedTaxQuestions = new WP_Query($query_args);
<?php endwhile ?>
<?php endif; ?>
<?php if ($currentThematiqueIsParent) : ?>
<p><?php echo $currentThematiqueIsParent['title'] ?></p>
<button><?php echo __("Charger plus de questions", $theme_namespace) ?></button>
<?php endif; ?>
</section>