Images in Widget

Home Forums Calendar Products Events Calendar PRO Images in Widget

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1234921
    Amy
    Participant

    This 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?

    #1236076
    Geoff
    Member

    Hi 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!

    #1251808
    Support Droid
    Keymaster

    Hey 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

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Images in Widget’ is closed to new replies.