diff --git a/includes/settings.php b/includes/settings.php index 61e7f07..74069bb 100644 --- a/includes/settings.php +++ b/includes/settings.php @@ -26,27 +26,42 @@ class CWV2_Settings { } + private function checked_array( $haystack, $cur, $show = true ) { + if ( is_array( $haystack ) && in_array( $cur, $haystack ) ) { + $cur = $haystack = 1; + } + if ( is_array( $haystack ) ) { //if $haystack is still an array, take first value + $haystack = array_shift( $haystack ); + } + + return checked( $haystack, $cur, $show ); + } + public function check( $args = array() ) { $args = $this->get_default_args( $args ); $field_id = $args['id']; $description = $args['desc']; $options = $args['options']; + $default = empty( $args['default'] ); if ( ! $options || empty( $field_id ) ) { return; } + $option_value = get_option( $field_id, $field_id, $default ); + ?>
$label ) { - $cur_id = $id . '-' . $offset; + foreach ( $options as $op_value => $label ) { + $cur_id = $op_value . '-' . $offset; $offset++; ?>