Creating custom description for .ics file

Home Forums Calendar Products Events Calendar PRO Creating custom description for .ics file

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #41168
    Dave
    Participant

    I’d like to specify the description that is automatically added to the .ics file for each event. Currently it adds the entire text of each event post. Either of these solutions would work for me:

    1. The .ics description displays the post excerpt
    2. The .ics description displays a custom field

    I can see this line on line 478 of events-calendar-pro.php:

    $item[] = ‘DESCRIPTION:’ . str_replace( ‘,’,’\,’, $description );

    Is that the line I should change? My php skills are advanced enough to know what to change it to. Could someone help me?

    #41275
    Jonah
    Participant

    Hi Dave,

    You should be able to filter the description using this filter:

    add_filter( 'tribe_ical_feed_item', 'filter_ical_item', 10, 2 );
    function filter_ical_item( $item, $eventPost ) {
    $item[] = 'DESCRIPTION:' . str_replace( ',','\,', $description );
    return $item;
    }

    Does that help?

    – Jonah

    #41287
    Dave
    Participant

    Hi Jonah –
    That looks like something that could help. Please forgive my ignorance, though – where would I put that? And how would it change the ics?

    #41292
    Jonah
    Participant

    Hi Dave,

    You would add that to your theme’s functions.php file. It would change the ics by filtering the item and allowing you to do whatever you want with the description.

    – Jonah

    #41296
    Dave
    Participant

    Ok – I understand now. I added this to my functions.php. This, however, it now adds an additional description the .ics (there are now 2 descriptions). How can I have this description replace the original, instead of adding to it?

    add_filter( ‘tribe_ical_feed_item’, ‘filter_ical_item’, 10, 2 );
    function filter_ical_item( $item, $eventPost ) {
    $item[] = ‘DESCRIPTION:’ . get_the_excerpt();
    return $item;
    }

    #41314
    Jonah
    Participant
Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Creating custom description for .ics file’ is closed to new replies.