Last active
October 27, 2018 05:26
-
-
Save cliffordp/7e687ec1d1cd7d89d2fa05af5b595d1f to your computer and use it in GitHub Desktop.
The Events Calendar (TEC) and Event Aggregator (EA): Add further-future import limits.
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 (TEC) and Event Aggregator (EA): Add further-future import limits. | |
* | |
* @link https://gist.github.com/cliffordp/7e687ec1d1cd7d89d2fa05af5b595d1f This snippet. | |
* | |
* @see \Tribe__Events__Aggregator__Settings::get_range_options() | |
*/ | |
function cliff_ea_add_further_future_import_range_options( $options ) { | |
// Add months 4-11 | |
for ( $i = 4; $i <= 11; $i ++ ) { | |
$text = sprintf( '%d months', $i ); | |
$options[$i * MONTH_IN_SECONDS] = [ | |
'title' => $text, | |
'range' => $text, | |
]; | |
} | |
// add 1 year | |
$options[YEAR_IN_SECONDS] = [ | |
'title' => '1 Year', | |
'range' => '1 year', | |
]; | |
// add 2 years | |
$options[2 * YEAR_IN_SECONDS] = [ | |
'title' => '2 Years', | |
'range' => '2 years', | |
]; | |
return $options; | |
} | |
// wp-admin > Events > Settings > Imports tab > "Global Import Settings" section | |
add_action( 'tribe_aggregator_import_range_options', 'cliff_ea_add_further_future_import_range_options' ); | |
// wp-admin > Events > Settings > Imports tab > "Other URL Import Settings" section | |
add_action( 'tribe_aggregator_url_import_range_options', 'cliff_ea_add_further_future_import_range_options' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment