I'm trying to add a class to the metabox, for doing so I have created the metabox element in this way:
array(
'label' => esc_html__( 'Property Lot Size', 'zoacres' ),
'desc' => esc_html__( 'Enter lot size of property by number. Do not use any special characters like comma, dot etc... Example 10000', 'zoacres' ),
'id' => $prefix.'lot_size',
'tab' => esc_html__( 'Property Details', 'zoacres' ),
'type' => 'text',
'default' => ''
'class' => 'zoacres-main'
),
the code above generate the metabox
but I doesn't have the class zoacres-main
why?
I'm trying to add a class to the metabox, for doing so I have created the metabox element in this way:
array(
'label' => esc_html__( 'Property Lot Size', 'zoacres' ),
'desc' => esc_html__( 'Enter lot size of property by number. Do not use any special characters like comma, dot etc... Example 10000', 'zoacres' ),
'id' => $prefix.'lot_size',
'tab' => esc_html__( 'Property Details', 'zoacres' ),
'type' => 'text',
'default' => ''
'class' => 'zoacres-main'
),
the code above generate the metabox
but I doesn't have the class zoacres-main
why?
1 Answer
Reset to default 0You didn't mention the library you're using to generate this meta, but i guess it's the cmb2 library, if it's so then you should change your array params as follow :
array(
'label' => esc_html__( 'Property Lot Size', 'zoacres' ),
'desc' => esc_html__( 'Enter lot size of property by number. Do not use any special characters like comma, dot etc... Example 10000', 'zoacres' ),
'id' => $prefix.'lot_size',
'tab' => esc_html__( 'Property Details', 'zoacres' ),
'type' => 'text',
'default' => '',
'attributes' => array(
'class' => 'zoacres-main'
)
),