Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add large image size for larger featured images #2254

Merged
merged 1 commit into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions newspack-theme/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ function newspack_setup() {
set_post_thumbnail_size( 1568, 9999 );

add_image_size( 'newspack-featured-image', 1200, 9999 );
add_image_size( 'newspack-featured-image-large', 2000, 9999 );
add_image_size( 'newspack-archive-image', 800, 600, true );
add_image_size( 'newspack-archive-image-large', 1200, 900, true );
add_image_size( 'newspack-footer-logo', 400, 9999 );
Expand Down
6 changes: 3 additions & 3 deletions newspack-theme/template-parts/post/large-featured-image.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
?>

<div class="featured-image-behind">
<?php newspack_post_thumbnail(); ?>
<?php newspack_post_thumbnail( 'newspack-featured-image-large' ); ?>
<div class="wrapper">
<header class="entry-header">
<?php get_template_part( 'template-parts/header/entry', 'header' ); ?>
Expand All @@ -30,15 +30,15 @@
</header>
</div><!-- .wrapper -->

<?php newspack_post_thumbnail(); ?>
<?php newspack_post_thumbnail( 'newspack-featured-image-large' ); ?>

<?php newspack_post_thumbnail_caption(); ?>
</div><!-- .featured-image-behind -->

<?php elseif ( 'above' === newspack_featured_image_position() ) : ?>

<div class="featured-image-above">
<?php newspack_post_thumbnail(); ?>
<?php newspack_post_thumbnail( 'newspack-featured-image-large' ); ?>

<header class="entry-header">
<?php get_template_part( 'template-parts/header/entry', 'header' ); ?>
Expand Down