Home Forums Front-end Issues Date_Picker: Translate month in a shortcode


Date_Picker: Translate month in a shortcode

  • 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;

    [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: ).
    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,

    (Google translator)

Viewing 1 post (of 1 total)

The topic ‘Date_Picker: Translate month in a shortcode’ is closed to new replies.