Heard about Admin Page Spider Pro?



$value ) { $input[ $key ] = apspider_sanitize_field( $value ); } return $input; } // For checkboxes, return '1' if checked, otherwise '' if ( is_bool( $input ) ) { return $input ? '1' : '0'; } // For text fields and other input types, sanitize with WordPress sanitize_text_field function return sanitize_text_field( $input ); } // Callback for a list of 'settings' for the sections function apspider_setup_fields() { global $fields; include_once('apspider-adminfieldsarray.php'); // Cycle through the settings, create the field and register the setting foreach( $fields as $field ){ add_settings_field( $field['uid'], $field['label'], 'apspider_field_callback', 'apspider_fields', $field['section'], $field ); register_setting( 'apspider_fields', $field['uid'], 'apspider_sanitize_field'); $uid = $field['uid']; $value = get_option($uid); if ( $value === false){ update_option($field['uid'], $field['default']); } } } // Callback to handle each scenario of each settings field created and passed to it. function apspider_field_callback( $arguments ) { $value = get_option( $arguments['uid'] ); if( ! $value ) { $value = $arguments['default']; } if ( ! empty ( $arguments['placeholder'] )){ $placeholder = esc_attr($arguments['placeholder']); } else { $placeholder = false ; } printf('
'); switch( $arguments['type'] ){ case 'text': printf( '', esc_attr($arguments['uid']), esc_attr($arguments['type']), esc_attr($placeholder), esc_attr($value) ); break; case 'password': // break; case 'number': // break; case 'textarea': printf( '', esc_attr($arguments['uid']), esc_attr($placeholder), esc_attr($value) ); break; case 'select': break; case 'multiselect': break; case 'radio': case 'checkbox': if( ! empty ( $arguments['options'] ) && is_array( $arguments['options'] ) ){ $options_markup = ''; $iterator = 0; foreach( $arguments['options'] as $key => $label ){ $iterator++; $options_markup .= sprintf( '
', esc_attr($arguments['uid']), esc_attr($arguments['type']), esc_attr($key), checked( $value[ array_search( $key, $value, true ) ], $key, false ), esc_attr($label), $iterator ); } $allowed_html = array( 'fieldset' => array(), 'legend' => array(), 'p' => array(), 'br' => array(), 'label' => array( 'for' => array(), ), 'form' => array( 'action' => array(), 'method' => array(), 'id' => array(), 'name' => array(), ), 'input' => array( 'type' => array(), 'name' => array(), 'value' => array(), 'id' => array(), 'class' => array(), 'placeholder' => array(), 'checked' => array(), 'disabled' => array(), 'readonly' => array(), 'required' => array(), ), 'textarea' => array( 'name' => array(), 'id' => array(), 'class' => array(), 'placeholder' => array(), 'cols' => array(), 'rows' => array(), 'readonly' => array(), 'disabled' => array(), 'required' => array(), ), 'select' => array( 'name' => array(), 'id' => array(), 'class' => array(), 'disabled' => array(), 'required' => array(), ), 'option' => array( 'value' => array(), 'selected' => array(), 'disabled' => array(), ), // Add other allowed tags and attributes here as needed ); printf( '
%s
', wp_kses($options_markup, $allowed_html )); // printf( '
%s
', $options_markup); } break; } if( ! empty ( $arguments['helper'] )) { printf( ' %s', esc_attr($arguments['helper']) ); } // Add a supplemental text field if you ever want to display an additional field if( ! empty ( $arguments['supplemental'] )) { printf( '

%s

', esc_attr($arguments['supplemental'] )); } printf('
'); }