Return to calendar link from event page

Home Forums Calendar Products Events Calendar PRO Return to calendar link from event page

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #993271
    Erwin Raaphorst
    Participant

    Is there a way we can create a link on the event page so that visitors can go straight from the event page to viewing it on the calendar. Currently you have to click on calendar and then the month you want.

    #993428
    Nico
    Member

    Howdy goodwebsites,

    Welcome to our support forums and thanks for reaching out to us.

    Just to be sure I understand your need, let me re-check what you ask here. You want to add a link to the individual events page -http://www.broxy.co.nz/event/waiuku-camp-2- to go back to the month view on the corresponding month for that event -http://www.broxy.co.nz/calendar/2015-09-, right?

    Please confirm this is what you are looking for and I’ll craft a snippet for you,
    Best,
    Nico

    #993597
    Erwin Raaphorst
    Participant

    Hi Nico

    Yep – that’s exactly what I like to do.

    Erwin πŸ˜‰

    #993840
    Nico
    Member

    Hey Erwin,

    Thanks for the follow-up!

    I crafted a little snippet for this, add it to your functions.php file – located at wp-content/themes/your_theme/ – and it show show the ‘calendar link’ for that event just above the event content:


    add_action ('tribe_events_single_event_before_the_content', 'generate_month_link' );

    function generate_month_link ( ) {
    $start_date = tribe_get_start_date(null, false, 'Y-m');
    $calendar_link = Tribe__Events__Main::instance()->getLink('month', $start_date);

    echo 'See this event in the calendar';
    }

    If you want this to show up in a different part of the template, you can change the action this is hooking to, available options are: tribe_events_single_event_before_the_content, tribe_events_single_event_after_the_content, tribe_events_single_event_before_the_meta or tribe_events_single_event_after_the_meta.

    Please let me know if this works for you,
    Best,
    Nico

    #994018
    Erwin Raaphorst
    Participant

    Hi Nico

    looks promising. Although the ‘->’ after ‘instance()’ seems to throw in an error.

    Erwin ;-(

    #994094
    Nico
    Member

    Oh! Seems it got incorrectly encoded in my reply. I’ll paste a Gist with the code, also tested it locally and it’s working just fine:

    https://gist.github.com/niconerd/e10459e0a6c4d5aaef72

    Please let me know if this makes sad Erwin happy again πŸ˜‰
    Best,
    Nico

    #994102
    Erwin Raaphorst
    Participant

    Big big SMILE…. πŸ˜‰
    Thanks heaps!

    #994680
    Nico
    Member

    Hey Erwin,

    Glad to hear pal πŸ™‚

    I’ll go ahead and close out this thread, but if you need help with anything else please don’t hesitate to create a new one and we will be happy to help.

    Best,
    Nico

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Return to calendar link from event page’ is closed to new replies.