Home › Forums › Calendar Products › Events Calendar PRO › Adjusting the .iCS Output
- This topic has 5 replies, 2 voices, and was last updated 10 years, 9 months ago by
Barry.
-
AuthorPosts
-
July 20, 2015 at 6:51 am #987784
Andrew Wolfe
ParticipantHi and thanks for the great plugin!
Been working hard lately to prep our new site and we’re almost ready. One of the things I’m trying to figure out how to do is to adjust what is included in the .ics file on export.
I need to change what goes in the description field in the ICS.
Currently it comes from the event content. Can I change what is exported for the ICS for DESCRIPTION to come from a custom field or at the very least from the Excerpt field?
Thank you for the help! Trying to avoid this type of scenario:
DESCRIPTION:[vc_row][vc_column width="1/1"][text_output]X-Play is an exciting summer day camp..July 20, 2015 at 10:34 am #987910Barry
MemberHi Andrew,
The tribe_ical_feed_item hook allows you to filter every item that is added to the iCal feed so that would be one option.
Here’s an example:
https://gist.github.com/barryhughes/c711c10505f000510b4a
This could for instance be added to your theme’s functions.php file, or else a custom plugin. Does that help at all?
July 20, 2015 at 10:59 am #987933Andrew Wolfe
ParticipantThat’s looking promising.
I had to change the if line and remove the space between the ! and the == to get it to parse. Debug mode reported an unexpected ! otherwise.
After changing that and testing it appeared to change the description in the file but they’re all blank. Perhaps that’s because I changed the intended logic by removing the space? Not sure.
July 20, 2015 at 11:08 am #987940Barry
MemberApologies, Andrew – I updated the snippet – do note that if excerpts are not defined then, yes, it will return an empty string for those events unless you change the logic further.
I hope that helps!
July 20, 2015 at 12:12 pm #987981Andrew Wolfe
ParticipantFantastic!
Is there a way to adjust the excerpt query line to query for a custom field added from the Settings screen in TEC?
For example, a custom text area field called “ICS Description”.
July 20, 2015 at 12:33 pm #988047Barry
MemberHi Andrew,
Yep – you could certainly do that by testing for the existence of such a field with something like:
$ical_description = get_post_meta( $post->ID, '_ics_description', true );
Then test to see if it is non-empty and use it: you can find out more about obtaining post meta here and there are also some useful posts in the WP Codex.
I hope that helps – and as we can’t really go much further with custom dev questions like this I will now close this topic – but hopefully it gets you pointed in the right direction 🙂
-
AuthorPosts
- The topic ‘Adjusting the .iCS Output’ is closed to new replies.
