FEATURE Introducing the ThumbnailFocalPosition plugin features

This commit is contained in:
Nonimart 2025-10-16 11:41:27 +02:00
parent a4175d1621
commit 5bbaeea7b3
5 changed files with 22 additions and 4 deletions

View File

@ -82,6 +82,7 @@ $thematiques = get_terms(array(
<?php while ($articles->have_posts()) : $articles->the_post(); ?>
<?php get_template_part('template-parts/articles/card-article', null, array(
'date' => get_the_date(),
'ThumbnailFocalPosition' => get_thumbnail_focal_point_css(),
'image' => get_the_post_thumbnail_url(),
'link' => get_the_permalink(),
'ID' => get_the_ID(),

View File

@ -17,7 +17,12 @@ $authors = get_field('authors', $ID);
<?php if ($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>
<?php endif; ?>
<div class="post-card__content">

View File

@ -26,7 +26,13 @@ $likes_count = get_post_likes_count($post_id);
<?php if ($hasThumbnail) : ?>
<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>
<?php endif; ?>

View File

@ -12,7 +12,12 @@ $is_multiple_issue_number = $issue_number && is_numeric($issue_number) && strpos
<?php if ($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>
<?php endif; ?>
<div class="post-card__content">

View File

@ -65,7 +65,8 @@ $thematiques = get_terms(array(
'date' => get_the_date(),
'image' => get_the_post_thumbnail_url(),
'link' => get_the_permalink(),
'ID' => get_the_ID()
'ID' => get_the_ID(),
'ThumbnailFocalPosition' => get_thumbnail_focal_point_css(),
)); ?>
<?php endwhile; ?>
<?php endif; ?>