By default, The Events Calendar shows the “+ Google Calendar” and “+ iCal Export” buttons (a.k.a. the Gcal and iCal links) immediately below the event description (post content) and above the event meta (details, organizer, venue, map). This placement is a little awkward. I would expect these links to be either at the very top, as part of the event header, or at the bottom, below the event meta. Or even in both places if event descriptions tend to be long. For that matter, it’s occurred to me to move the event meta, which contains the most pertinent information, below the event header and above the event content, but that’s an exercise for another time.
Here are the Gcal and iCal links in their standard position:
To move them below the event meta, but above the related events, add the following to your theme’s
//* Relocate ical and gcal links below meta remove_action('tribe_events_single_event_after_the_content', array('Tribe__Events__iCal', 'single_event_links')); add_action('tribe_events_single_event_after_the_meta', array('Tribe__Events__iCal', 'single_event_links'), 5);
You need the priority number when adding the links in order to be sure they appear above the Related Events, like this:
If you wanted to position the Gcal and iCal links before the content, you would change your add_action() to
add_action('tribe_events_single_event_before_the_content', array('Tribe__Events__iCal', 'single_event_links'));
That defaults to displaying the Gcal and iCal links below the event featured image but above the content. I’m not aware of a hook you can use to put the links above the featured image. That might require editing the template file.
I was mildly appalled to discover that the Modern Tribe knowledgebase actually includes a tutorial on hiding these links with CSS rather than removing them. I really don’t know why you would hide them rather than remove them.
display:none is generally frowned-upon these days. However, they do have a custom plugin for removing all export links, if you’d prefer getting rid of them to relocating them. (If you only want to remove the links from the single event view, just use the
remove_action() code above without adding the action back in anywhere.)
Thank you, this worked a treat for our site! Appreciated!
Cenay Nailor says
Just a quick update to make this code current. They changed the second parameter’s form. This was what I got working when I tried to move the links to below the content.
remove_action( ‘tribe_events_single_event_after_the_content’, array( tribe( ‘tec.iCal’ ), ‘single_event_links’ ) );
add_action(‘tribe_events_single_event_after_the_meta’, array(tribe( ‘tec.iCal’ ), ‘single_event_links’), 5);