Renaming and adapting cards conseils thematiques

This commit is contained in:
Antoine M 2023-11-30 18:05:43 +01:00
parent 8b3a40851f
commit 13225dbc41
3 changed files with 18 additions and 3 deletions

View File

@ -31,7 +31,7 @@
@import '../../template-components/cards/card-news.css'; @import '../../template-components/cards/card-news.css';
@import '../../template-components/cards/card-frequent_question.css'; @import '../../template-components/cards/card-frequent_question.css';
@import '../../template-components/cards/card-thematique.css'; @import '../../template-components/cards/card-conseils-thematique.css';
@import '../../template-components/cards/page-card.css'; @import '../../template-components/cards/page-card.css';
@import '../../template-components/post-conseils/chapter-header.css'; @import '../../template-components/post-conseils/chapter-header.css';
@import '../../template-components/post-questions/chapter-header.css'; @import '../../template-components/post-questions/chapter-header.css';

View File

@ -2,10 +2,25 @@
// $thematique est un post type object term de la taxonomie thematiques // $thematique est un post type object term de la taxonomie thematiques
$thematique = $args['thematique']; $thematique = $args['thematique'];
$taxonomy_picture = get_field('taxonomy_pictures', $thematique) ?? null; $taxonomy_picture = get_field('taxonomy_pictures', $thematique) ?? null;
$color = getThematiqueFamilySlug($thematique->slug); $color = getThematiqueFamilySlug($thematique->slug);
$args = array(
'posts_per_page' => 1,
'post_type' => 'conseils',
'tax_query' => array(
array(
'taxonomy' => 'thematiques',
'field' => 'term_id',
'terms' => $thematique->term_id,
'include_children' => false
)
)
);
$relatedThematiqueConseilsQuery = new WP_Query($args);
$relatedPostConseil = $relatedThematiqueConseilsQuery->posts[0] ?? null;
?> ?>
<div class="card-thematique card-<?php echo $thematique->slug ?>" data-taxonomy="<?php echo $thematique->slug ?>"> <div class="card-thematique card-<?php echo $thematique->slug ?>" data-taxonomy="<?php echo $thematique->slug ?>">
<?php if ($taxonomy_picture && $taxonomy_picture['illustration_s']) : ?> <?php if ($taxonomy_picture && $taxonomy_picture['illustration_s']) : ?>
@ -14,7 +29,7 @@ $color = getThematiqueFamilySlug($thematique->slug);
<h3 class="card-thematique__title text-<?php echo getThematiqueFamilySlug($thematique->slug) ?>"><?php echo $thematique->name ?></h3> <h3 class="card-thematique__title text-<?php echo getThematiqueFamilySlug($thematique->slug) ?>"><?php echo $thematique->name ?></h3>
<p class="card-thematique__description"><?php echo $thematique->description ?></p> <p class="card-thematique__description"><?php echo $thematique->description ?></p>
<a class="card-thematique__cta hover:text-<?php echo getThematiqueFamilySlug($thematique->slug) ?>" href="<?php echo get_term_link($thematique) ?> "> <a class="card-thematique__cta hover:text-<?php echo getThematiqueFamilySlug($thematique->slug) ?>" href="<?php echo get_permalink($relatedPostConseil->ID) ?>">
<?php echo __("En savoir plus ", "homegrade-theme__texte-fonctionnel") ?> <?php echo __("En savoir plus ", "homegrade-theme__texte-fonctionnel") ?>
<span class="sr-only"><?php echo __("sur ", "homegrade-theme__texte-fonctionnel") ?><?php echo $thematique->slug ?></span> <span class="sr-only"><?php echo __("sur ", "homegrade-theme__texte-fonctionnel") ?><?php echo $thematique->slug ?></span>
<div class="cta_arrow_button"> <div class="cta_arrow_button">