Created
July 14, 2023 09:16
-
-
Save Matt-Welland/3aef9cd61301d1ff2e28826ca78bd04e to your computer and use it in GitHub Desktop.
Custom Image Sizes and Rendering of...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Example setting some image sizes | |
add_image_size( 'hero', 1900, 940 ); | |
add_image_size( 'square-large', 1200, 1200, true ); | |
add_image_size( 'square', 600, 600, true ); | |
add_image_size( 'featured-large', 2280, 860, true ); | |
add_image_size( 'featured', 1140, 430, true ); | |
add_image_size( 'image-block', 1140, 430, false ); | |
add_image_size( 'teaser-large', 720, 480, true ); | |
add_image_size( 'teaser', 360, 240, true ); | |
add_image_size( 'teaser-nocrop', 360, 240, false ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Example with ACF Image | |
$card_image = get_sub_field( 'image' ); | |
echo esc_url( $card_image['sizes']['square'] ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment