Home › Forums › Calendar Products › Events Calendar PRO › Images in Widget
- This topic has 3 replies, 4 voices, and was last updated 9 years, 1 month ago by
Amy.
-
AuthorPosts
-
February 14, 2017 at 6:44 pm #1234921
Amy
ParticipantThis is the site I am considering buying Events Calendar Pro for (I already have it for another site), and my question is whether I can add thumbnails of the event’s featured image to the widget that lists the events on the front page (or wherever you want them listed).
I looked this up in your FAQs and found a post that said to put this code in the java script area, but either I didn’t copy the code correctly or it just didn’t work for me:
function custom_widget_featured_image() {
global $post;echo tribe_event_featured_image( $post->ID, ‘thumbnail’ );
}
add_action( ‘tribe_events_list_widget_before_the_event_title’, ‘custom_widget_featured_image’ );Can you help?
February 15, 2017 at 11:58 am #1236076Geoff
MemberHi Amy,
Welcome back to the forums!
Hmm, that snippet looks like it should do the trick. But let’s look at another method since it doesn’t seem to be doing the trick.
Another way to do it is to override the widget template and add the featured image directly into the code. You can learn more about overriding calendar templates in our <u>Themer’s Guide</u>, but it basically boils down to this:
- Make a copy of the single-event.php template. It is located at /wp-content/plugins/events-calendar-pro/src/views/widgets/modules/single-event.php
- Make a new folder in your theme called tribe-events
- Make a new folder in that one called pro
- Make a new folder in that one called widgets
- Make a new folder in that one called modules
- Drop your copied single-event.php file in that last folder
Now that the template is in your theme, you can modify it to suit your needs. In this case add the featured image where you would like it to display. For example, you can add this to right after the closing PHP tag on line 54:
<?php the_post_thumbnail( $thumbnail_size ); ?>Will this work for you? Please let me know. 🙂
Cheers!
March 9, 2017 at 8:35 am #1251808Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Images in Widget’ is closed to new replies.
