【问题标题】:maxlength on input field wordpress customizer输入字段 wordpress 定制器的最大长度
【发布时间】:2021-07-13 11:43:03
【问题描述】:

是否可以在我在定制器中使用的输入字段上设置最大长度。

就像在数组中添加一些额外的设置:maxlength = > 50;

通过:

$wp_customize->add_control( 'textblock-text-content', array(
            'label'      => 'Tekstblok tekst',
            'section'   => 'textblock_background_section',
            'type'   => 'textarea',
        ));

我找不到任何解决方案,我希望这里的任何人都可以指导我解决问题。

【问题讨论】:

    标签: php wordpress input wordpress-theming customizer


    【解决方案1】:

    根据Customizer Objects docs,你可以像这样使用input_attrs参数:

    $wp_customize->add_control('textblock-text-content', array(
        'label' => 'Tekstblok tekst',
        'section' => 'textblock_background_section',
        'type' => 'textarea',
        'input_attrs' => array(
            'maxlength' => 20
        )
    ));
    

    【讨论】:

    • @Flierp 这回答了你的问题吗?
    猜你喜欢
    • 1970-01-01
    • 2014-10-17
    • 1970-01-01
    • 1970-01-01
    • 2022-01-17
    • 1970-01-01
    • 2012-06-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多