Support » Plugin: OptionTree » [Plugin: OptionTree] Checkbox – how to default to checked?

  • How can I force a checkbox to be checked by default in a metabox? Here’s my code below:

    array(
     'id'      => 'platform_link_target',
     'label'   => 'Link Target',
     'desc'    => 'Do you want the link to open in a new window?',
     'std'     => '',
     'type'    => 'checkbox',
     'class'   => '',
     'choices' => array(
    
        array(
         'label'	=> 'Yes',
         'value'	=> '_blank'
        )
      )
    )

    Thanks in advance!
    Stephane

    http://wordpress.org/extend/plugins/option-tree/

Viewing 3 replies - 1 through 3 (of 3 total)
  • I have the same question.
    Please help!

    I think you may have to use some jQuery for this. Add a CSS class when you create the option and then register a script to run in the admin section which takes care of checking the checkbox.

    Well I don’t want to put that much work into it, I thought there might have been a default option I missed like ‘default’ => ‘true’ for example.

    Thanks for the answer anyways Yojance!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: OptionTree] Checkbox – how to default to checked?’ is closed to new replies.