Created
May 17, 2017 13:28
-
-
Save barryhughes/88e64e1306175b320249778351b354aa to your computer and use it in GitHub Desktop.
Other URL import - extend date range options (TEC 4.5.x REST API / Other URL imports)
This file contains hidden or 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 | |
| /** | |
| * Supports accessing and importing events upto 2yrs in the future when using | |
| * the "Other URL" import feature. | |
| * | |
| * Note that the source site may have a cap on the number of events it will | |
| * "yield". The "tribe_rest_event_max_per_page" filter hook can be used there | |
| * to increase that, if it is a site under your own control. | |
| */ | |
| function tec_rest_api_add_additional_import_ranges( array $ranges ) { | |
| $ranges[ MONTH_IN_SECONDS * 6 ] = array( | |
| 'title' => 'Six months', | |
| 'range' => 'six months', | |
| ); | |
| $ranges[ MONTH_IN_SECONDS * 12 ] = array( | |
| 'title' => 'One year', | |
| 'range' => 'one year', | |
| ); | |
| $ranges[ MONTH_IN_SECONDS * 18 ] = array( | |
| 'title' => 'Eighteen months', | |
| 'range' => 'eighteen months', | |
| ); | |
| $ranges[ MONTH_IN_SECONDS * 24 ] = array( | |
| 'title' => 'Two years', | |
| 'range' => 'two years', | |
| ); | |
| return $ranges; | |
| } | |
| function tec_rest_api_increase_max_import_range() { | |
| return MONTH_IN_SECONDS * 24; | |
| } | |
| add_filter( 'tribe_aggregator_url_import_range_cap', 'tec_rest_api_increase_max_import_range' ); | |
| add_filter( 'tribe_aggregator_url_import_range_options', 'tec_rest_api_add_additional_import_ranges' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment