Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use checked() and add ability to default checkbox on

To set the checkbox default, set the 'std' item to true or 1
  • Loading branch information...
commit ac031c1e88db1453ec9603aeed76fb121491ee63 1 parent 40fbb59
@JPry JPry authored
Showing with 1 addition and 1 deletion.
  1. +1 −1  init.php
View
2  init.php
@@ -272,7 +272,7 @@ function show() {
echo '<p class="cmb_metabox_description">', $field['desc'], '</p>';
break;
case 'checkbox':
- echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';
+ echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', checked( ( $meta == true || $field['std'] ), true, false ), ' />';
echo '<span class="cmb_metabox_description">', $field['desc'], '</span>';
break;
case 'multicheck':
Please sign in to comment.
Something went wrong with that request. Please try again.