首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >无法向metabox添加类

无法向metabox添加类
EN

WordPress Development用户
提问于 2019-09-25 11:01:15
回答 1查看 30关注 0票数 0

为此,我尝试向metabox添加一个类,这样我就以这种方式创建了metabox元素:

代码语言:javascript
复制
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,为什么?

EN

回答 1

WordPress Development用户

发布于 2019-09-25 11:25:02

您没有提到用于生成此元数据的库,但我猜它是cmb2库,如果是这样的话,您应该按如下方式更改数组参数:

代码语言:javascript
复制
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'
     )
),
票数 0
EN
页面原文内容由WordPress Development提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://wordpress.stackexchange.com/questions/349043

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档