I’m having trouble figuring out how to format ACF Date Time Picker in Loop.
I need to split the date meta in three seperate divs. One for the month, A second for Day, another for time. I’ve found this thread, but can’t seem to get the info contain to work: Outputting ACF Fields (+ formatting them)
Can you have 3 divs. Each has:
<div>{acf_field_date_name:m}</div>
<div>{acf_field_date_name:d}</div>
<div>{acf_field_date_name:h:i:s}</div>
Sorry Not working get Fatal Error, any ideas why?
Fatal error: Uncaught Error: Call to a member function format() on bool in /home/customer/www/private/public_html/wp-content/themes/bricks/includes/integrations/dynamic-data/providers/provider-acf.php:380 Stack trace: #0 /home/customer/www/private/public_html/wp-content/themes/bricks/includes/integrations/dynamic-data/providers.php(201): Bricks\Integrations\Dynamic_Data\Providers\Provider_Acf->get_tag_value(‘acf_event_date_…’, Object(WP_Post), Array, ‘text’) #1 /home/customer/www/private/public_html/wp-content/themes/bricks/includes/integrations/dynamic-data/providers.php(138): Bricks\Integrations\Dynamic_Data\Providers->get_tag_value(‘acf_event_date_…’, Object(WP_Post), ‘text’) #2 /home/customer/www/private/public_html/wp-includes/class-wp-hook.php(308): Bricks\Integrations\Dynamic_Data\Providers->render(‘<div class="brx…’, Object(WP_Post), ‘text’) #3 /home/customer/www/private/public_html/wp-includes/plugin.php(205): WP_ in /home/customer/www/private/public_html/wp-content/themes/bricks/includes/integrations/dynamic-data/providers/provider-acf.php on line 380
Was able to get working with this snippet:
function prfx_format_date($date,$format) {
$date = get_field($date);
return date($format);
}
and then using this:
{echo:prfx_format_date('event_date_time','m')}
hi, your snippet is working great but it lost language setting. thx