12/21/2017 at 5:06 pm
#444971
Keymaster
RE: it does not keep the date. It resets to 01/01/1970 each time I save it.
I copied/pasted your code into a snippet as is since it looks correct at a glance. It seems to work just fine. Perhaps the date format set on the WordPress General Settings admin page is incompatible. I suggest using one of the default fate formats vs. using a custom date format.
RE: display
Try this:
$datepicker = $entry->getMeta(
array(
'key' => 'priest_ordo_date',
'single' => TRUE
)
);
$text = $entry->getMeta(
array(
'key' => 'priest_ordain_bishop',
'single' => TRUE
)
);
if ( ! empty( $datepicker ) && ! empty( $$text ) ) {
$date = cnDate::createFromFormat( 'd/m/Y', $datepicker )->format( 'j F Y' );
echo '<strong>Priest Ordination:</strong>' . $date . ' by ' . $text;
}
