12/21/2017 at 3:16 pm
#444957
Guest
I have the following in snippets:
// Register the metabox and field.
add_action( 'cn_metabox', 'cn_register_priest_ordo' );
function cn_register_priest_ordo() {
$atts = array(
'title' => 'Priesthood Ordination Date',
'id' => 'priest_ordo_date_metabox',
'context' => 'normal',
'priority' => 'core',
'fields' => array(
array(
'name' => 'Date',
'show_label' => TRUE,
'id' => 'priest_ordo_date',
'type' => 'datepicker',
),
array(
'name' => 'Ordaining Bishop',
'show_label' => TRUE,
'id' => 'priest_ordain_bishop',
'type' => 'text',
'size' => 'regular',
),
),
);
cnMetaboxAPI::add( $atts );
}
However, it does not keep the date. It resets to 01/01/1970 each time I save it.
Also, I cannot get it to display on the entry. I created a child template and inserted this:
$datepicker = $entry->getMeta(
array(
'key' => 'priest_ordo_date',
'single' => TRUE
)
);
if ( ! empty( $datepicker ) ) echo '' . esc_html( $datepicker ) . '';
$text = $entry->getMeta(
array(
'key' => 'priest_ordain_bishop',
'single' => TRUE
)
);
if ( ! empty( $text ) ) echo '' . esc_html( $text ) . '';
But it does not display on the entry in the front end.
Thanks!
BG
