Next Event URL, Date, Title, and thumbnail

Home Forums Calendar Products Events Calendar PRO Next Event URL, Date, Title, and thumbnail

  • This topic has 5 replies, 2 voices, and was last updated 9 years ago by Logan.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1268519
    Logan
    Participant

    I have exhausted my search trying to figure out how to extract the URL, Date, Title, and thumbnail from the_next_event and add it to a single event screen. Please help. I just bought Pro only to try and figure this out.

    #1269341
    Logan
    Participant

    Anyone??

    #1269870
    Trisha
    Member

    Hi, Logan!

    Thanks for your patience, this was a bit of a puzzle on our end as well. Grabbing a post object or post ID is easy work for a normal post in WordPress (as you know). But since we’re sorting the events by the event start date it was a bit more complex.

    I ended up modifying the query we use for the ‘get next event’ link to make it happen.

    See if this works for you:

    https://gist.github.com/trishasalas/1ebb4428f59a6873af22af176f7bee79

    You’ll need to move single-event.php into your theme as outlined in the themer’s guide here: https://theeventscalendar.com/knowledgebase/themers-guide/

    Let me know how it goes!

    Cheers,
    Trisha

    #1270897
    Logan
    Participant

    Thanks so much!! I ended up figuring it out with this (below), but your way is probably much better…

    function tribe_add_thumbnail_to_single_next( $link ) {
    global $post;
    $next = Tribe__Events__Main::instance()->get_closest_event( $post, ‘ next’ );
    if ( ! is_a( $next, ‘WP_Post’ ) || ! isset( $next->ID ) ) {
    return $link;
    }
    return tribe_get_next_event_link(‘ID, thumbnail, false, false ) . ‘” />

    Next Event:

    ‘ . get_the_title( $next->ID ) . ‘

    ‘);// . $link;
    }
    add_filter( ‘tribe_the_next_event_link’, ‘tribe_add_thumbnail_to_single_next’ );

    #1270905
    Trisha
    Member

    Hi Logan,

    Glad you got it worked out! Either way is good as long as it works for you 🙂

    Cheers,
    Trisha

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Next Event URL, Date, Title, and thumbnail’ is closed to new replies.