Last active
April 21, 2016 21:54
-
-
Save elimn/532aa266f1a74463509b to your computer and use it in GitHub Desktop.
MT | TEC | Export 1 year of iCal events from The Events Calendar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* The Events Calendar Get Events for 1 Year from Today in iCal Export File | |
* add coding to theme's functions.php | |
* To trigger the export go to this URL: http://yoursite.com/events/?ical=1&year-feed | |
* You can change 365 (days) to export more or less events | |
*/ | |
function tribe_one_year_ics_export( $query ) { | |
if ( ! isset( $_GET['ical'] ) || ! isset( $_GET['year-feed'] ) ) { | |
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', " + 365 day" ); | |
$query->set( 'posts_per_page', - 1 ); | |
} | |
add_action( 'pre_get_posts', 'tribe_one_year_ics_export' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment