Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/wordpress/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何默认选中多个复选框选项?_Php_Wordpress_Checkbox - Fatal编程技术网

Php 如何默认选中多个复选框选项?

Php 如何默认选中多个复选框选项?,php,wordpress,checkbox,Php,Wordpress,Checkbox,我需要在默认情况下选择选项“Twitter、Facebook和Google Plus”。以下是代码的一部分: function setup_settings() { $this->boxes = array( 'ch_box_settings' => array( 'title' => __('Widget Settings', 'contesthopper'), 'fields' =>

我需要在默认情况下选择选项“Twitter、Facebook和Google Plus”。以下是代码的一部分:

function setup_settings()
{        
    $this->boxes = array(
        'ch_box_settings' => array(
            'title' => __('Widget Settings', 'contesthopper'),
            'fields' => array(
                'ch_social' => array(
                    'id' => 'ch_social',
                    'type' => 'checkbox',
                    'title' => __('Social buttons', 'contesthopper'),
                    'description' => __('Select the checkboxes above to display social share buttons after you capture an email.', 'contesthopper'),
                    'options' => array(
                        'twitter' => 'Twitter',
                        'facebook' => 'Facebook',
                        'googleplus' => 'Google+',
                        'linkedin' => 'LinkedIn',
                        'pinit' => 'Pinterest'
                    ),
                    'conditional' => array(
                        'twitter' => 'ch_box_twitter',
                        'facebook' => 'ch_box_facebook',
                        'linkedin' => 'ch_box_linkedin',
                        'pinit' => 'ch_box_pinit'
                    )
                ),
使用的插件:


()

如果您在网页上使用了此功能,请右键单击小部件并选择inspect element。如果复选框具有ID或容器具有ID,则可以使用javascript将该元素中的所有复选框元素作为目标。我想猜测一下,Chu social=容器,Chu box\u twitter要么是这个盒子的容器,要么是元素的id。你试过/能用javascript吗?