Advanced Custom Fields Date instead of Post Date
-
Hey guys,
Not really a question, just wanted to push this out into the world as a solution to something I was having difficulty with. If you want to use an Events custom field and then display the events in FullCalendar, it will pull through the post date and not the event date.
I made these three tweaks and the calendar started pulling through the event date.
Comment out this line (for me it was at line 186):
//$where .= $wpdb->prepare(” AND post_date >= %s AND post_date < %s”, $_REQUEST[‘start’], $_REQUEST[‘end’]);Then add this line around line 196 under $color and before $post_date:
$time_date = get_field(‘your_acf_date‘);
And use this new parameter to modify the following lines below:
$post_date = substr($time_date, 0, 10);
$post_timestamp = strtotime($time_date);And voila! Perfect to use if you just want to update dates and don’t need to be messing around with the actual time an event starts.
Hope it help!
- The topic ‘Advanced Custom Fields Date instead of Post Date’ is closed to new replies.