ICS feed for all existing (but not past) events

Home Forums Calendar Products Events Calendar PRO ICS feed for all existing (but not past) events

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #959141
    Mark
    Participant

    I noticed that when you copy/paste the URL for the ICS feed for our events, that it only pulls up that page’s events. I scoured through the forums and was only able to find one topic that led me to this code:

    add_action( ‘pre_get_posts’, ‘full_ical_export’ );

    function full_ical_export( WP_Query $query ) {
    if ( ! isset( $_GET[‘ical’] ) || ! isset( $_GET[‘full-export’] ) ) return;
    if ( ! isset( $query->tribe_is_event_query ) || ! $query->tribe_is_event_query ) return;

    $query->set( ‘eventDisplay’, ‘custom’ );
    $query->set( ‘start_date’, ‘1000-01-01’ );
    $query->set( ‘end_date’, ‘3000-01-01’ );
    $query->set( ‘posts_per_page’, ‘-1’ );
    }

    However, I do not want to pull any previous events or past dates to avoid any memory problems. Is there a way to add code or find a way to pull the ICS feed for all current existing events to come?

    #959247
    Barry
    Member

    Hi Mark,

    So what you’re experiencing is the expected and intentional behaviour.

    If you want to leverage the code snippet you found you can certainly give that a go. Simply replace 1000-01-01 with now (still within single quotes) and it should do what you want here 🙂

    Does that help?

    #959302
    Mark
    Participant

    Adding that code seems to create syntax errors. My current functions.php file looks like this, which is causing errors:

    <?php
    /**
    * Remove “share” prompt text from end of gCal-exported descriptions.
    * @link http://theeventscalendar.com/support/forums/topic/sharing-options-for-events/
    */
    function remove_tags_from_gcal_links( array $params ) {

    $cleaned = html_entity_decode( strip_tags( apply_filters( ‘the_content’, urldecode( $params[‘details’] ) ) ), ENT_QUOTES, ‘UTF-8’ );

    $to_remove = ‘Share this with others via:’;

    $pos = ( strlen( $cleaned ) – strpos( $cleaned, $to_remove ) );
    $trimmed = substr( $cleaned, 0, ( -$pos ) );

    $params[‘details’] = urlencode( $trimmed );

    return $params;
    }

    add_filter( ‘tribe_google_calendar_parameters’, ‘remove_tags_from_gcal_links’ );

    // Second solution – links on the right of the organizer box (after)
    add_action( ‘tribe_events_single_event_meta_primary_section_end’, array( ‘TribeiCal’, ‘single_event_links’ ) );
    remove_action( ‘tribe_events_single_event_after_the_content’, array( ‘TribeiCal’, ‘single_event_links’ ) );

    add_action( ‘pre_get_posts’, ‘full_ical_export’ );

    function full_ical_export( WP_Query $query ) {
    if ( ! isset( $_GET[‘ical’] ) || ! isset( $_GET[‘full-export’] ) ) return;
    if ( ! isset( $query->tribe_is_event_query ) || ! $query->tribe_is_event_query ) return;

    $query->set( ‘eventDisplay’, ‘custom’ );
    $query->set( ‘start_date’, ‘now′ );
    $query->set( ‘end_date’, ‘3000-01-01′ );
    $query->set( ‘posts_per_page’, ‘-1′ );
    }

    ?>

    #959311
    Barry
    Member

    Hi Mark!

    It’s hard to assess for syntax errors when you paste code in plain text (simply because so many characters are converted to a form that would be “illegal” within a PHP environment).

    What are the actual errors you are hitting here and can you share the code via Pastebin, Gist or some other similar tool?

    Thanks!

    #959316
    Mark
    Participant

    Here is the code I am using: https://gist.github.com/anonymous/32ad876dcb9fa147f18f

    The error I get is this:
    Parse error: syntax error, unexpected T_STRING in /home/anccbell/public_html/wp-content/themes/salient-child/functions.php on line 8

    #959401
    Barry
    Member

    Hi Mark,

    So sometimes when you copy and paste code from the forums, depending on how it was formatted and a few other factors, various symbols can be transformed.

    In this case, take a look at the single quotes on line 8 (and you’ll actually see the same thing throughout the code you shared). These should be straight quotes – but instead we have a different form of quote, a “fancy quote” if you will, that PHP doesn’t understand – you’ll need to correct these and any other symbols that have similarly been transformed.

    Wrong:

    apply_filters( ‘the_content’, urldecode( $params[‘details’] ) )

    Right:

    apply_filters( 'the_content', urldecode( $params['details'] ) )

    As you correct things if you get any further errors of a similar nature please check out the referenced line and see if any of the symbols jump out at you 🙂

    #962585
    Barry
    Member

    Hi!

    It’s been a while so I’m going to go ahead and close this topic.

    • Need help with anything else? Go right ahead and post a new topic, one of the team will be only too happy to help
    • Still need help with this issue and need to re-open it? Again, please simply create a new topic and link to this one to provide the team with some context

    Thanks!

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘ICS feed for all existing (but not past) events’ is closed to new replies.