Home › Forums › Calendar Products › Events Calendar PRO › Change Featured Image Size on Single Event
- This topic has 7 replies, 3 voices, and was last updated 8 years, 9 months ago by
Remy.
-
AuthorPosts
-
July 6, 2017 at 6:41 pm #1317191
Remy
ParticipantCannot change featured image size on single event.
Instead of showing full image, a hard-cropped image appears such as with: https://outbuzz.com/gay-parties/battle-hymn-2017-07-07/ The dimensions do not seem to be a defined image size in the function.php file or in the core WP either (this one is 720×321).
July 7, 2017 at 9:56 am #1317498Mathew
ParticipantRemy,
The Enfold theme sets the featured image size to a custom defined size of ‘845×321’ named ‘entry_with_sidebar’ within the /config-events-calendar/views/single-event.php file.
It appears that you are using a child theme. To override Enfold’s custom size, you can add this conditional filter to the functions.php file within the child theme folder.
// Change size of featured image on single events
add_filter( 'post_thumbnail_size', 'custom_single_event_post_thumbnail_size');
function custom_single_event_post_thumbnail_size($size) {
if( !is_singular('tribe_events') ) {
return;
}
if( ! has_post_thumbnail() ) {
return;
}
$size = 'full'; // Set desired image size here.
return $size;
}
Hope this helps.
July 7, 2017 at 1:27 pm #1317642Shelby
ParticipantHi there Remy,
I’d be happy to help out here!
Did Mathew’s thoughts help you here? 🙂 Mathew, thanks for jumping in on this one!
Let me know Remy, and we’ll work this out!
Best,
Shelby 🙂
July 15, 2017 at 8:41 am #1321684Remy
ParticipantThanks for the help!
When I use that code it does work, but it also affects thumbnail sizes for the sidebar and not just for TEC single images.July 17, 2017 at 7:56 pm #1322443Shelby
ParticipantHi Remy,
Unfortunately, modifying all of the thumbnails is the only way that I’m aware of to make that change. If you need some more complex custom code, I’d recommend hiring a freelancer to help out. 🙂 We have some ideas about that here.
Please let me know if you have any follow up questions or need clarification!
Best,
Shelby 🙂
July 18, 2017 at 6:39 am #1322586Remy
ParticipantHi Shelby,
Using Enfold, the solution is to create a copy of the single-event.php file in the child theme and change the image size below from ‘entry_with_sidebar’ to ‘full’
<?php echo tribe_event_featured_image($event_id, ‘full’, false); ?>
Otherwise you will change the size for every instance site-wide of ‘entry_with_sidebar’ to ‘full’.
July 19, 2017 at 9:02 am #1323301Shelby
ParticipantHi there,
Thanks for sharing your solution here, we appreciate it!
Best,
Shelby 🙂
-
AuthorPosts
- The topic ‘Change Featured Image Size on Single Event’ is closed to new replies.
