Here are three ways to modify event image sizes for The Events Calendar and Events Calendar Pro. Add the function you want to either your functions.php file or a custom functions file. Do not use more than one of these functions on any given site.
Last active
March 16, 2022 15:34
-
-
Save wpfangirl/8bcdfca4b9f213291033effe870970f6 to your computer and use it in GitHub Desktop.
Modify the Event Image Size with Filters (The Events Calendar)
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
// Change size of featured image on single events using post_thumbnail_size | |
add_filter( 'post_thumbnail_size', 'ebwp_single_event_post_thumbnail_size'); | |
function ebwp_single_event_post_thumbnail_size($size) { | |
if( !is_singular('tribe_events') ) { | |
return; | |
} | |
if( ! has_post_thumbnail() ) { | |
return; | |
} | |
$size = 'large'; // Change to your desired image size. | |
return $size; | |
} |
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
// Change size of ALL event images (but not featured images for other post types) | |
add_filter('tribe_event_featured_image_size', 'ebwp_event_featured_image_size'); | |
function ebwp_event_featured_image_size($size) { | |
$size = 'large'; // Change to your desired image size | |
return $size; | |
} |
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
// Change size of featured image on single events from 'full' to 'large' | |
add_filter('tribe_event_featured_image_size', 'ebwp_single_event_featured_image_size'); | |
function ebwp_single_event_featured_image_size($size) { | |
if( ! is_singular('tribe_events') ) { | |
return; | |
} | |
if( ! has_post_thumbnail() ) { | |
return; | |
} | |
$size = 'large'; // Change to your desired image size. | |
return $size; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you so much for sharing! The 3rd one helped me immediately. The only thing that is now occuring is that every image is now shown in it's original aspect ratio. Is there any chance to keep the ratio 1:1?