View difference between Paste ID: N2zbKRcM and 0YKGPzbE
SHOW: | | - or go back to the newest paste.
1
/**
2
* Pasted at Line 25 in child theme copy of table-mini.php of tri.be's The Events Calendar
3
* Let's force the widget to default to a specific month on the initial view.
4
* Custom Month set up in ACF options as "mini-calendar-default-month-display"
5
* (advancedcustomfields.com)
6
* We assume if the request isn't ajax that it is indeed the initial view.
7
*/
8
if (!defined('DOING_AJAX')) {
9
	$optional_start_date = get_field('mini_calendar_default_month_display', 'options') ? DateTime::createFromFormat('Ymd', get_field('mini_calendar_default_month_display', 'options'))  : $current_date;
10
	$optional_start_date = $optional_start_date->format('Y-m-d');
11
	
12
	echo "optional: " . $optional_start_date;
13
	if ($current_date < $optional_start_date) {
14-
		$current_date = $optional_start_date;
14+
		$current_date = $wp_query->query_vars['eventDate'] = $optional_start_date;
15
	}
16
}