handling videos-webinaires thumbnail specialty

This commit is contained in:
Antoine M 2024-07-03 10:21:32 +02:00
parent d89e334aa3
commit e0b2e362e3
3 changed files with 11 additions and 13 deletions

File diff suppressed because one or more lines are too long

View File

@ -4,25 +4,24 @@ $postType = get_post_type_object(get_post_type($relatedPostId));
$relatedPost = get_post($relatedPostId) ?? null;
$relatedPostUrl = get_permalink($relatedPostId) ?? null;
$cover = get_field('cover', $relatedPostId) ?? null;
$postThumbnail = get_the_post_thumbnail_url($relatedPostId) ?? null;
$target = $postType->name === 'fiches-infos' ? "_blank" : "_self";
$thematique = get_the_terms($relatedPostId, 'thematiques')[0];
$mainThematique = getMainThematique($thematique);
$thematiqueColorSlug = $mainThematique->slug;
$thematique_icon = get_field('taxonomy_pictures', 'thematiques' . '_' . $mainThematique->term_id)['icon'];
// echo '<pre>';
// print_r($postType);
// echo '</pre>';
$coverUrl = $postType->name === 'videos-webinaires' && $postThumbnail ? $postThumbnail : ($thematique_icon ? $thematique_icon['url'] : null);
?>
<a class="post-card" href="<?php echo $relatedPostUrl ?>" target="<?php echo $target ?>">
<img class="post-card__cover" src="<?php echo $thematique_icon['url'] ?>" alt="">
<img class="post-card__cover post-card__cover--<?php echo $postType->name ?>" src="<?php echo $coverUrl ?>" alt="">
<div class="post-card__details">
<div class="post-card__tags">
<?php if ($mainThematique) : ?>
<div class="tag thematique-tag thematique-tag--<?php echo $mainThematique->slug ?>"><?php echo $mainThematique->name ?></div>
<?php endif; ?>

View File

@ -4,25 +4,24 @@ $postType = get_post_type_object(get_post_type($relatedPostId));
$relatedPost = get_post($relatedPostId) ?? null;
$relatedPostUrl = get_permalink($relatedPostId) ?? null;
$cover = get_field('cover', $relatedPostId) ?? null;
$postThumbnail = get_the_post_thumbnail_url($relatedPostId) ?? null;
$target = $postType->name === 'fiches-infos' ? "_blank" : "_self";
$thematique = get_the_terms($relatedPostId, 'thematiques')[0];
$mainThematique = getMainThematique($thematique);
$thematiqueColorSlug = $mainThematique->slug;
$thematique_icon = get_field('taxonomy_pictures', 'thematiques' . '_' . $mainThematique->term_id)['icon'];
// echo '<pre>';
// print_r($postType);
// echo '</pre>';
$coverUrl = $postType->name === 'videos-webinaires' && $postThumbnail ? $postThumbnail : ($thematique_icon ? $thematique_icon['url'] : null);
?>
<a class="post-card" href="<?php echo $relatedPostUrl ?>" target="<?php echo $target ?>">
<img class="post-card__cover" src="<?php echo $thematique_icon['url'] ?>" alt="">
<img class="post-card__cover post-card__cover--<?php echo $postType->name ?>" src="<?php echo $coverUrl ?>" alt="">
<div class="post-card__details">
<div class="post-card__tags">
<?php if ($mainThematique) : ?>
<div class="tag thematique-tag thematique-tag--<?php echo $mainThematique->slug ?>"><?php echo $mainThematique->name ?></div>
<?php endif; ?>