Skip to content

Instantly share code, notes, and snippets.

@andrasguseo
Created December 27, 2023 21:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrasguseo/175c40178f081548b1fd7f84f65a3f93 to your computer and use it in GitHub Desktop.
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
<?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