Adjusting the .iCS Output

Home Forums Calendar Products Events Calendar PRO Adjusting the .iCS Output

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #987784
    Andrew Wolfe
    Participant

    Hi 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..

    #987910
    Barry
    Member

    Hi 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?

    #987933
    Andrew Wolfe
    Participant

    That’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.

    #987940
    Barry
    Member

    Apologies, 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!

    #987981
    Andrew Wolfe
    Participant

    Fantastic!

    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”.

    #988047
    Barry
    Member

    Hi 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 🙂

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Adjusting the .iCS Output’ is closed to new replies.