Show Related Events Outside TEC Loop

Home Forums Calendar Products Events Calendar PRO Show Related Events Outside TEC Loop

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #989582
    Marsha Genthner
    Participant

    How might one create a function to show related events in a single event post, but outside the Event Calendar loop?

    #989682
    Nico
    Member

    Hi shenandoahu,

    Thanks for getting in touch, I’ll try to help you out on this one.

    You can call the function ‘tribe_single_related_events’ which will include the related events template.

    Do you think this might work for you? Or you just want the related posts without the template?

    Please try it out and let me know,
    Best,
    Nico

    #991138
    Marsha Genthner
    Participant

    I need the related events without the template, because I need to call the function outside the TEC loop, in the page template’s loop instead.

    #991561
    Nico
    Member

    Hey shenandoahu,

    Thanks for the follow-up!

    To get just the related posts use ‘tribe_get_related_posts’. It accepts two parameters, the first one is the amount of posts and the second one is the event ID. Defaults are 3 posts and the current post ID. Once you get the posts you’ll need to loop those and output the info for each one, you can take a look at how that’s done in the related events template at ‘wp-content/plugins/events-calendar-pro/src/views/pro/related-events.php’.

    Please let me know if this is what you were looking for,
    Best,
    Nico

    #995729
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Show Related Events Outside TEC Loop’ is closed to new replies.