Compare commits
4 Commits
a26a889f35
...
7338d58e6e
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7338d58e6e | ||
|
|
f8faed6650 | ||
|
|
5bbaeea7b3 | ||
|
|
a4175d1621 |
|
|
@ -517,3 +517,38 @@ function get_search_snippet($post_id, $search_term, $context_length = 150)
|
||||||
|
|
||||||
return $snippet;
|
return $snippet;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper sécurisé pour récupérer le focal point (avec fallback si plugin désactivé)
|
||||||
|
*
|
||||||
|
* @param int|null $post_id ID du post (null pour le post courant)
|
||||||
|
* @return array Tableau avec 'x' et 'y' (valeurs entre 0 et 1)
|
||||||
|
*/
|
||||||
|
function safe_get_thumbnail_focal_point($post_id = null)
|
||||||
|
{
|
||||||
|
// Vérifier si la fonction du plugin existe
|
||||||
|
if (function_exists('get_thumbnail_focal_point')) {
|
||||||
|
return get_thumbnail_focal_point($post_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback : centre de l'image par défaut
|
||||||
|
return ['x' => 0.5, 'y' => 0.5];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Helper sécurisé pour récupérer le focal point au format CSS (avec fallback si plugin désactivé)
|
||||||
|
*
|
||||||
|
* @param int|null $post_id ID du post (null pour le post courant)
|
||||||
|
* @return string Format "50% 50%" pour object-position ou background-position
|
||||||
|
*/
|
||||||
|
function safe_get_thumbnail_focal_point_css($post_id = null)
|
||||||
|
{
|
||||||
|
// Vérifier si la fonction du plugin existe
|
||||||
|
if (function_exists('get_thumbnail_focal_point_css')) {
|
||||||
|
return get_thumbnail_focal_point_css($post_id);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Fallback : centre de l'image par défaut
|
||||||
|
return '50% 50%';
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,16 @@
|
||||||
@apply lg:flex gap-16 xl:gap-32;
|
@apply lg:flex gap-16 xl:gap-32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__subtitle {
|
||||||
|
br {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
@screen lg {
|
||||||
|
br {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
.tag-list {
|
.tag-list {
|
||||||
@apply flex gap-6 flex-wrap;
|
@apply flex gap-6 flex-wrap;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,9 @@ $articles = get_field('articles', $current_issue->ID);
|
||||||
<ul class="tags-list">
|
<ul class="tags-list">
|
||||||
<?php foreach ($tags as $tag) : ?>
|
<?php foreach ($tags as $tag) : ?>
|
||||||
<li>
|
<li>
|
||||||
<a class="article-tag" href="<?php echo get_term_link($tag); ?>"><?php echo $tag->name; ?></a>
|
<a class="article-tag" href="<?php echo add_query_arg('etiquette', $tag->slug, get_post_type_archive_link('articles')); ?>">
|
||||||
|
<?php echo $tag->name; ?>
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,9 @@ $tags = get_the_terms($articleID, 'etiquettes');
|
||||||
<ul class="article-tags-list">
|
<ul class="article-tags-list">
|
||||||
<?php foreach ($tags as $tag) : ?>
|
<?php foreach ($tags as $tag) : ?>
|
||||||
<li class="article-tag">
|
<li class="article-tag">
|
||||||
<?php echo $tag->name; ?>
|
<a href="<?php echo add_query_arg('etiquette', $tag->slug, get_post_type_archive_link('articles')); ?>">
|
||||||
|
<?php echo $tag->name; ?>
|
||||||
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
||||||
|
|
@ -82,6 +82,7 @@ $thematiques = get_terms(array(
|
||||||
<?php while ($articles->have_posts()) : $articles->the_post(); ?>
|
<?php while ($articles->have_posts()) : $articles->the_post(); ?>
|
||||||
<?php get_template_part('template-parts/articles/card-article', null, array(
|
<?php get_template_part('template-parts/articles/card-article', null, array(
|
||||||
'date' => get_the_date(),
|
'date' => get_the_date(),
|
||||||
|
'ThumbnailFocalPosition' => get_thumbnail_focal_point_css(),
|
||||||
'image' => get_the_post_thumbnail_url(),
|
'image' => get_the_post_thumbnail_url(),
|
||||||
'link' => get_the_permalink(),
|
'link' => get_the_permalink(),
|
||||||
'ID' => get_the_ID(),
|
'ID' => get_the_ID(),
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,12 @@ $authors = get_field('authors', $ID);
|
||||||
|
|
||||||
<?php if ($cover) : ?>
|
<?php if ($cover) : ?>
|
||||||
<div class="post-card__cover">
|
<div class="post-card__cover">
|
||||||
<img src="<?php echo $cover; ?>" alt="<?php echo $title; ?>">
|
<?php
|
||||||
|
$focal_position = $args['ThumbnailFocalPosition'] ?? null;
|
||||||
|
echo get_the_post_thumbnail($ID, 'full', [
|
||||||
|
'style' => 'object-fit: cover; object-position: ' . esc_attr($focal_position) . ';'
|
||||||
|
]);
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="post-card__content">
|
<div class="post-card__content">
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,13 @@ $likes_count = get_post_likes_count($post_id);
|
||||||
|
|
||||||
<?php if ($hasThumbnail) : ?>
|
<?php if ($hasThumbnail) : ?>
|
||||||
<div class="thumbnail-wrapper">
|
<div class="thumbnail-wrapper">
|
||||||
<?php the_post_thumbnail('full', ['class' => 'thumbnail']); ?>
|
<?php
|
||||||
|
$focal_position = safe_get_thumbnail_focal_point_css();
|
||||||
|
the_post_thumbnail('full', [
|
||||||
|
'class' => 'thumbnail',
|
||||||
|
'style' => 'object-fit: cover; object-position: ' . esc_attr($focal_position) . ';'
|
||||||
|
]);
|
||||||
|
?>
|
||||||
<div class="thumbnail-overlay"></div>
|
<div class="thumbnail-overlay"></div>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,12 @@ $is_multiple_issue_number = $issue_number && is_numeric($issue_number) && strpos
|
||||||
|
|
||||||
<?php if ($cover) : ?>
|
<?php if ($cover) : ?>
|
||||||
<div class="post-card__cover">
|
<div class="post-card__cover">
|
||||||
<img src="<?php echo $cover; ?>" alt="<?php echo $title; ?>">
|
<?php
|
||||||
|
$focal_position = $args['ThumbnailFocalPosition'] ?? null;
|
||||||
|
echo get_the_post_thumbnail($ID, 'full', [
|
||||||
|
'style' => 'object-fit: cover; object-position: ' . esc_attr($focal_position) . ';'
|
||||||
|
]);
|
||||||
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="post-card__content">
|
<div class="post-card__content">
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,8 @@ $thematiques = get_terms(array(
|
||||||
'date' => get_the_date(),
|
'date' => get_the_date(),
|
||||||
'image' => get_the_post_thumbnail_url(),
|
'image' => get_the_post_thumbnail_url(),
|
||||||
'link' => get_the_permalink(),
|
'link' => get_the_permalink(),
|
||||||
'ID' => get_the_ID()
|
'ID' => get_the_ID(),
|
||||||
|
'ThumbnailFocalPosition' => get_thumbnail_focal_point_css(),
|
||||||
)); ?>
|
)); ?>
|
||||||
<?php endwhile; ?>
|
<?php endwhile; ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user