• Resolved arthurcarlos

    (@arthurcarlos)


    Hi. How can I format the custom field which is a date?

    I want to show as DD/MM/YYYY but now it’s shown as YYYYMMDD.

    Thank you.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hello,
    The format used for date is what you have set in wp-admin > Settings.

    Thread Starter arthurcarlos

    (@arthurcarlos)

    Hi Manzoor.

    No, it’s not that. The WP Settings is ok.

    I’m using the ACF Plugin for my custom fields. Is that a problem?

    Take a look: https://prnt.sc/pin3ut

    • This reply was modified 5 years, 5 months ago by arthurcarlos.

    Is there any option to set the date format in ACF, if not then it needs custom code to get the job done. In that case, what’s the field name in ACF?

    Thread Starter arthurcarlos

    (@arthurcarlos)

    Yes, it’s set to the DD/MM/YYYY on the visual format.

    The name is: {cf:data_do_jogo}

    Here is the code you can use:

    /* WP Telegram | Get field value from ACF */
    add_filter(
    	'wptelegram_p2tg_post_data_cf:data_do_jogo_value',
    	function ( $value, $post ) {
    		if ( function_exists( 'get_field' ) ) {
    			$value = get_field( 'data_do_jogo', $post->ID );
    		}
    		return $value;
    	},
    	10,
    	2
    );
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Custom Field Date’ is closed to new replies.