• Resolved royassas

    (@royassas)


    Trying to subscribe to my Events Manager iCal Feed I noticed that my events didn’t show up. Later I also discovered that teamup.com can’t use my feed either.

    The resulting .ics I receive by calling the URL: https://mydomain.com/events.ics has two empty lines in the beginning. If I remove those lines the .ics file gets accepted.

    The ics.php output in the templates doesn’t seem to add those two empty lines.

    So my question is:
    Which file do i need to modify to remove these two empty lines?

    The page I need help with: [log in to see the link]

Viewing 7 replies - 1 through 7 (of 7 total)
  • joneiseman

    (@joneiseman)

    You would need to copy and then modify the template file wp-content/plugins/events-manageer/templates/templatess/ical.php

    The instructions for doing this can be found here: https://wp-events-plugin.com/documentation/using-template-files/

    Change line 120 of ical.php from this:

    $output = "\r\n"."BEGIN:VEVENT

    To this:

    $output = "BEGIN:VEVENT
    Thread Starter royassas

    (@royassas)

    Hey @joneiseman

    Missed your reply. Sorry.
    Thanks for your help. Your suggestions changes the linebreak bevor a “VEVENT”. But what I need is to erase the linebreaks bevor the “BEGIN:VCALENDAR” which is at about line 22. There is no “\r\n” to delete there.

    It might have to do with line 36?:

    echo preg_replace("/([^\r])\n/", "$1\r\n", $output_header);

    Someone else had a problem with the iCalendar feed and it turned out it was related to a caching plugin. Here’s the thread: https://wordpress.org/support/topic/ical-feed-doest-validate/

    Thread Starter royassas

    (@royassas)

    Don’t think it’s a caching problem in my case. If I change my template of ics.php the ICS file changes, too.

    The validator accepts my events.ics as valid. I guess it deletes whitespace bevore analyzing the text. But webservices linking to my ics throw an error. By deleting the whitespace bevor the BEGIN: VCALENDAR manually, the file got accepted.

    This is a image from the generated .ics in VS Code: https://zigerschlitzmakers.ch/wp-content/uploads/2023/05/linebreak.png

    When I download the events.ics on my website I don’t see the empty lines. Can you try using a default themes (e.g., Twenty Twenty-Three) and disable all the plugins (except Events Manager) and see if you still see the problem?

    Thread Starter royassas

    (@royassas)

    Now I’m confused.

    You are right! Using the 2023 theme does make the empty lines vanish! Reactivating my SOHO theme brings them back. But this doesn’t explain why you didn’t get the empty lines.

    Why is a plugin-generated file dependent on the theme other than for styling purposes? can you point me in a direction where to look for the problem in the theme’s files?

    I don’t really know what the conflict is between the SOHO theme and the EM plugin. Maybe check with SOHO theme support to see if they can help?

    I see in em_ical.php in the function em-ical that it’s calling the php header function to output the header for the generated ics feed maybe the SOHO theme is also writing out something in the page header.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘iCalender Feed Format – Remove empty lines at beginning of file’ is closed to new replies.