Home › Forums › Calendar Products › Events Calendar PRO › Return to calendar link from event page
- This topic has 7 replies, 2 voices, and was last updated 10 years, 9 months ago by
Nico.
-
AuthorPosts
-
August 4, 2015 at 4:35 pm #993271
Erwin Raaphorst
ParticipantIs 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.
August 5, 2015 at 7:51 am #993428Nico
MemberHowdy 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,
NicoAugust 5, 2015 at 2:07 pm #993597Erwin Raaphorst
ParticipantHi Nico
Yep – that’s exactly what I like to do.
Erwin π
August 6, 2015 at 6:48 am #993840Nico
MemberHey 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,
NicoAugust 6, 2015 at 12:12 pm #994018Erwin Raaphorst
ParticipantHi Nico
looks promising. Although the ‘->’ after ‘instance()’ seems to throw in an error.
Erwin ;-(
August 6, 2015 at 7:01 pm #994094Nico
MemberOh! 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,
NicoAugust 6, 2015 at 7:32 pm #994102Erwin Raaphorst
ParticipantBig big SMILE…. π
Thanks heaps!August 10, 2015 at 4:53 am #994680Nico
MemberHey 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 -
AuthorPosts
- The topic ‘Return to calendar link from event page’ is closed to new replies.
