Since the WordPress built-in calendar does not support custom post types, using a third party version https://wordpress.org/plugins/cpt-calender-widget/. It pulls in the date based on the published date rather than the start and end date set using the Date Picker with Advanced Custom Fields (ACF).
Attempting to update the plugin code https://pastebin.com/0URjDg5Q to pull from the ACF date fields instead.
Assuming the relevant code is the following (but feel free to look at pastebin for full code):
// Get days with posts
$dayswithposts = $wpdb->get_results( "SELECT DISTINCT DAYOFMONTH( post_date )
FROM $wpdb->posts WHERE MONTH( post_date ) = '$thismonth'
AND YEAR( post_date ) = '$thisyear'
AND post_type IN ( $post_types ) AND post_status = 'publish'
AND post_date < '" . current_time( 'mysql' ) . '\'', ARRAY_N );
if ( $dayswithposts ) {
foreach ( (array) $dayswithposts as $daywith ) {
$daywithpost[] = $daywith[0];
}
} else {
$daywithpost = array();
And use this to what I use to get upcoming events based on the ACF date fields:
<?php
// Upcoming Events & Events Underday
$now = date('Y-m-d H:i:s');
$args = array(
'post_type' => 'events_post_type',
'posts_per_page' => -1,
'meta_query' => array(
'relation' => 'OR',
'date_upcoming_clause' => array(
'key' => 'event_start_date',
'compare' => '>=',
'value' => $now,
'type' => 'DATETIME'
),
array(
'relation' => 'AND',
'date_started_clause' => array(
'key' => 'event_start_date',
'compare' => '<=',
'value' => $now,
'type' => 'DATETIME'
),
'date_end_clause' => array(
'key' => 'event_end_date',
'compare' => '>=',
'value' => $now,
'type' => 'DATETIME'
),
),
),
'orderby' => array(
'date_started_clause' => 'ASC',
'date_end_clause' => 'ASC',
'date_upcoming_clause' => 'ASC',
),
);
$the_query = new WP_Query($args);
?>
Is there a simple way to have the plugin code utilize the relevant ACF code? ACF is very logical, but unfamiliar with the calendar plugin method which calls the database directly. To note, this use was looking for relatively the same but do not believe found an answer: WORDPRESS: Calendar with custom post type + custom fields. To note, if there is an easier way to do this with the native get_calendar open to that as well.