为此,我尝试向metabox添加一个类,这样我就以这种方式创建了metabox元素:
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'
),上面的代码生成metabox,但我没有类zoacres-main,为什么?
发布于 2019-09-25 11:25:02
您没有提到用于生成此元数据的库,但我猜它是cmb2库,如果是这样的话,您应该按如下方式更改数组参数:
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'
)
),https://wordpress.stackexchange.com/questions/349043
复制相似问题