如何根据选项选择显示/隐藏WordPress元框字段

时间:2015-04-03 06:59:02

标签: jquery html5 wordpress wordpress-theming meta-boxes

我有一个包含值hostshtml5的选择列表以及3个自定义字段。选择值hosts时,应显示2个字段(Youtube和Vimeo),如果值为html5,则应显示剩余(嵌入)。

array(
    'name'     => __( 'Video File Host', 'suarezthemelocal' ),
    'id'       => 'videohost',
    'desc' => __( 'Select host of your video file. <br> <strong>Note:</strong> If you couldn\'t find host of your video file in the dropdown list, you can paste the embed code of file in the "Video Embed Code" box.', 'rwmb' ),
    'type'     => 'select',
    // Array of 'value' => 'Label' pairs for select box
    'options'  => array(
        'host' => __( 'Video Hosts', 'suarezthemelocal' ),
        'html5' => __( 'HTML5 Video', 'suarezthemelocal' ),
    ),
    // Select multiple values, optional. Default is false.
    'multiple'    => false,
    'std'         => '',
    'placeholder' => __( 'Select an Item', 'suarezthemelocal' ),
),
array(
    'name' => __('Youtube Video ID','suarezthemelocal'),
    'id' => 'video_youtube_id',
    'type' => 'text',
    'std' => '',
    'desc' => __('Youtube video ID','suarezthemelocal')
),
array(
    'name' => __('Vimeo Video ID','suarezthemelocal'),
    'id' => 'video_vimeo_id',
    'type' => 'text',
    'std' => '',
    'desc' => __('Vimeo video ID','suarezthemelocal')
),
array(
    'name' => __('Video Embed Code','suarezthemelocal'),
    'id' => 'video_embed_code',
    'type' => 'textarea',
    'std' => '',
    'desc' => __('Video Embed code. You can grab embed codes from hosted video sites.','suarezthemelocal')
)

感谢您的帮助。

0 个答案:

没有答案