Hello everyone.
I try in vain to teach my date shortcode that it outputs the month in German (e.g. März). Unfortunately so far without success.
add_shortcode( 'acf_date', function($atts) {
extract( shortcode_atts( array(
'field' => '',
'post_id' => false,
'format_value' => true,
'date_format' => ''
), $atts ));
$acf_date = get_field( $field, $post_id, $format_value );
$date = new DateTime ($acf_date);
$value = $date->format( $date_format);
return $value;
});
Shortcode:
[acf_date field="ux0000-start-event" date_format='d. M Y']
The code is inserted in my functions.php and its job is to change my ACF date field (see function: https://support.advancedcustomfields.com/forums/topic/displaying-shortcode-of-date_picker-with-format/ ).
The date field is determined automatically or the code refers to all fields that are a date field.
Maybe someone of you knows the solution, how I can have the date automatically translated into German.
Thanks a lot,
Seb.Mxx
(Google translator)