Meta Box
Support Forum
Support › General › Duplicated dateResolved
Why I get duplicated data? I will retrieve a field 'datum' and formats the date:
Friday 7 May 2021Datum: Friday 7 May 2021
<?php $field_id = 'datum'; $value = rwmb_the_value( $field_id, array( 'format' => 'l j F Y' ) ); echo "Datum: " . $value ; ?>
Hi Cees,
The helper function rwmb_the_value() does not need to use the echo, it outputs the content of the field. Your code should change to this
echo
<?php $field_id = 'datum'; ?> <span><?php echo "Datum: "?></span><?php rwmb_the_value( $field_id, array( 'format' => 'l j F Y' ) ); ?>
Refer to this topic https://support.metabox.io/topic/why-does-echo-rwmb_the_value-display-a-value-twice/
Do this only work when : Save value as timestamp?
Hi,
If you use the settings timestamp to save value as timestamp, you can use the helper function rwmb_meta().
timestamp
rwmb_meta()
$value = rwmb_meta( 'datum' ); echo 'Datum: ' . date( 'F j, Y', $value );
Get more details on the documentation https://docs.metabox.io/fields/date/#template-usage