Home Forums Feature Requests Date_Picker: Translate month in a shortcode


Date_Picker: Translate month in a shortcode

    • SebMxx

    • April 2, 2020 at 9:45 pm

    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)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.