Reputation: 310
How to possible number type input field in wordpress cmb2 ? I want number type input field and set default value.
$cmb->add_field( array(
'name' => __( 'Number Title', 'myprefix' ),
'desc' => __( 'field description (optional)', 'myprefix' ),
'id' => 'number-id',
'type' => '',
'default' => '30',
) );
Upvotes: 1
Views: 1381
Reputation: 822
try this
$cmb->add_field( array(
'name' => 'Standard Number Field',
'description' => 'Number Field',
'id' => $prefix.'test_number',
'type' => 'text',
'attributes' => array(
'type' => 'number',
),
) );
Upvotes: 6