'text', 'id' => 'start_number', 'desc' => '', 'label_for' => 'start_number' ); $increment = array( 'type' => 'text', 'id' => 'increment', 'desc' => '', 'label_for' => 'increment' ); $time = array( 'type' => 'text', 'id' => 'time', 'desc' => '', 'label_for' => 'time' ); $title = array( 'type' => 'text', 'id' => 'title', 'desc' => '', 'label_for' => 'title' ); $desc = array( 'type' => 'text', 'id' => 'desc', 'desc' => '', 'label_for' => 'desc' ); $video = array( 'type' => 'text', 'id' => 'video', 'desc' => 'If the field is empty, the default value will be used', 'label_for' => 'video' ); add_settings_field('start_number', __('Start number'), 'dv_counter_display_settings', $dv_counter_option_page, 'dv_counter_section_1', $start_number); add_settings_field('increment', __('Increment number'), 'dv_counter_display_settings', $dv_counter_option_page, 'dv_counter_section_1', $increment); add_settings_field('time', __('Duration time'), 'dv_counter_display_settings', $dv_counter_option_page, 'dv_counter_section_1', $time); add_settings_field('title', __('Title'), 'dv_counter_display_settings', $dv_counter_option_page, 'dv_counter_section_1', $title); add_settings_field('desc', __('Description'), 'dv_counter_display_settings', $dv_counter_option_page, 'dv_counter_section_1', $desc); add_settings_field('video', __('Video'), 'dv_counter_display_settings', $dv_counter_option_page, 'dv_counter_section_1', $video); } /** * Render settings */ function dv_counter_display_settings($args) { extract($args); $option_name = 'dv_counter_options'; $option = get_option($option_name); switch ($type) { case 'text': $option[ $id ] = esc_attr(stripslashes($option[ $id ])); echo ""; echo ($desc != '') ? "
$desc" : ""; break; case 'textarea': $option[$id] = esc_attr( stripslashes($option[$id]) ); echo ""; echo ($desc != '') ? "
$desc" : ""; break; case 'checkbox': $checked = ($option[$id] == 'on') ? " checked='checked'" : ''; echo ""; break; case 'select': echo ""; break; case 'radio': echo "
"; foreach($vals as $v => $l) { $checked = ($option[$id] == $v) ? "checked='checked'" : ''; echo "
"; } echo "
"; break; } } /** * Validation settings */ function dv_counter_validate_settings($input) { foreach ($input as $key => $val) { $valid_input[ $key ] = trim($val); } return $valid_input; }