refactoring parent thematiques urls

This commit is contained in:
Antoine M 2023-11-30 15:33:07 +01:00
parent 6539145946
commit 1bd9842c53

View File

@ -37,11 +37,7 @@ $page_icon = get_field('page_icon', get_queried_object());
|| $thematique->slug === "au-quotidien" || $thematique->slug === "au-quotidien"
|| $thematique->slug === "dagelijks" || $thematique->slug === "dagelijks"
) continue; ) continue;
// $thematique_icon = get_field('taxonomy_pictures', $thematique->term_id)['icon'];
// $translated_term_id = icl_object_id($thematique->term_id, $thematique->taxonomy, true, ICL_LANGUAGE_CODE);
// $thematique_icon = get_field('taxonomy_pictures', $thematique->taxonomy . '_' . $translated_term_id)['icon'];
$original_term_ID = apply_filters('wpml_object_id', $thematique->term_id, 'thematiques', FALSE, 'fr'); $original_term_ID = apply_filters('wpml_object_id', $thematique->term_id, 'thematiques', FALSE, 'fr');
$thematique_icon = get_field('taxonomy_pictures', $thematique->taxonomy . '_' . $original_term_ID)['icon']; $thematique_icon = get_field('taxonomy_pictures', $thematique->taxonomy . '_' . $original_term_ID)['icon'];
$termSlug = getThematiqueFamilySlug($thematique->slug); $termSlug = getThematiqueFamilySlug($thematique->slug);
@ -54,15 +50,17 @@ $page_icon = get_field('page_icon', get_queried_object());
'taxonomy' => 'thematiques', 'taxonomy' => 'thematiques',
'field' => 'term_id', 'field' => 'term_id',
'terms' => $thematique->term_id, 'terms' => $thematique->term_id,
'include_children' => false
) )
) )
); );
$relatedPostConseil = get_posts($args);
$relatedThematiqueConseilsQuery = new WP_Query($args);
$relatedPostConseil = $relatedThematiqueConseilsQuery->posts[0] ?? null;
?> ?>
<?php if ($relatedPostConseil) : ?> <?php if ($relatedPostConseil) : ?>
<li class="term"> <li class="term">
<a href="<?php echo get_permalink($relatedPostConseil[0]->ID) ?>"> <a href="<?php echo get_permalink($relatedPostConseil->ID) ?>">
<img src="<?php echo $thematique_icon['url'] ?>" alt=""> <img src="<?php echo $thematique_icon['url'] ?>" alt="">
<p class="text-<?php echo $termSlug ?>"><span class="sr-only">Question </span><?php echo $thematique->name ?></p> <p class="text-<?php echo $termSlug ?>"><span class="sr-only">Question </span><?php echo $thematique->name ?></p>
</a> </a>