How to display fields in template
-
Probably it is a basic thing, but I don’t know hot to display a select fields value on a custom template page.
I only get the key
$cmb->add_field( array( 'name' => __( 'Item Unit', 'cmb2' ), 'desc' => __( 'field description (optional)', 'cmb2' ), 'id' => $prefix . 'item_unit', 'type' => 'select', 'show_option_none' => false, 'options' => array( 'kg' => __( 'Kilogram', 'cmb2' ), 'g' => __( 'gram', 'cmb2' ), 'l' => __( 'liter', 'cmb2' ), ), ) );when using the
echo get_post_meta( get_the_ID(), $prefix.’item_unit’, true );I can only get “kg”, but I want to get “Kilogram”
Is there any page where there is a list of all the fields and their display method(examples with different options)?
Thanks.
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
The topic ‘How to display fields in template’ is closed to new replies.