Full .ics export

Home Forums Calendar Products Events Calendar PRO Full .ics export

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #932789
    Michael
    Participant

    Is there a way to do a full ics export of the entire Calendar?

    #932828
    Barry
    Member

    Hi!

    It’s possible, yes. Do note that customizations like this are really something you need to drive forward by yourself, but as a possible starting point how about adding a snippet like this to a custom plugin or your theme’s functions.php file?

    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' );
    }

    Then, if you visit example.com/events/?ical=1&full-export (of course modify the URL to match your own site) it should generate an iCal feed of all events past, present and future.

    Do also be aware that if you have a very large number of events this could potentially cause some timeout/memory challenges, depending on your server setup.

    I hope that helps!

    #932879
    Michael
    Participant

    Barry

    Thank you for the guidance.

    I ran the script as you outlined and it only produced 5 events out of 500+.

    Any insight?

    Mike

    #932908
    Barry
    Member

    I unfortunately see the “white screen of death” when I try it directly on your site (using the URL you provided when you opened this topic).

    How many events do you have in total? Perhaps it’s a memory issue and execution is ending before the list can be fully generated. One way to test this theory is modify the ‘-1′ element of the snippet to ’50’ – if it produces 50 results as expected, it’s basically doing its job.

    Begin increasing it to higher numbers and ultimately back to unlimited (-1) – see if there is a point at which it stops working.

    Does that provide any useful results?

    #938787
    Barry
    Member

    Hi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘Full .ics export’ is closed to new replies.