Created
December 27, 2023 21:44
-
-
Save andrasguseo/175c40178f081548b1fd7f84f65a3f93 to your computer and use it in GitHub Desktop.
TEC > Move the starting date of the subscribe feed back by 2 months
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 | |
/** | |
* Move the starting date of the subscribe feed back by 2 months. | |
* | |
* Usage: Add the snippet to your functions.php file or with a plugin like Code Snippets | |
* | |
* Plugins required: The Events Calendar | |
* Author: Andras Guseo | |
* Created: December 27, 2023 | |
*/ | |
add_filter( 'tec_views_v2_subscribe_links_url_args', 'tec_custom_subscribe' ); | |
function tec_custom_subscribe( $passthrough_args ) { | |
// Get the current date | |
$currentDate = new DateTime(); | |
// Subtract two months from the current date | |
$twoMonthsAgo = $currentDate->modify('-2 months'); | |
// Format the result in YYYY-MM format | |
$result = $twoMonthsAgo->format('Y-m'); | |
$passthrough_args['tribe-bar-date'] = $result; | |
return $passthrough_args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment