function sf_ajax_optionsearch() { $data = array(); $i = 0; preg_match_all('^(.*)\\[(.*)\\]^', $_POST['val'], $match); $data_type = $match[1][0]; $data_value = $match[2][0]; if ($data_type == 'meta') { $terms = get_postmeta_values($data_value); if (is_array($terms)) { foreach ($terms as $term) { $data[$i]['key'] = $term->meta_value; $data[$i]['val'] = $term->meta_value; $i++; } } } elseif ($data_type == 'tax') { $args = array('orderby' => 'name', 'order' => 'ASC', 'hide_empty' => true); $terms = get_terms($data_value, $args); if (is_array($terms)) { foreach ($terms as $term) { $data[$i]['key'] = $term->term_id; $data[$i]['val'] = $term->name; $i++; } } } echo json_encode($data); die; }
foreach ($terms as $term) { ?> <label><input type="radio" value="<?php echo $term->term_id; ?> " name="<?php echo $key; ?> " /> <?php echo $term->name; ?> </label> <?php } } elseif ($data_type == 'meta' && $element['options'] == 'auto') { $values = get_postmeta_values($data_value); foreach ($values as $val) { ?> <label><input type="radio" value="<?php echo esc_attr($val->meta_value); ?> " name="<?php echo $key; ?> " /> <?php echo $val->meta_value; ?> </label> <?php } } elseif ($data_type == 'others') {