form h2 { background-color: lightblue ; padding: 20px; cursor: pointer;}

Admin Page Spider FREE

'; settings_fields( "apspider_fields" ); do_settings_sections( "apspider_fields" ); submit_button(); echo '
'; // Create the message which appears at the bottom of the settings page echo '

What is the Admin Page Spider Pro Pack?


THE PRO PACK FEATURES


Learn More Here

'; echo '

'; } //Run the setup fields after the section has been created add_action( 'admin_init', 'apspider_setup_fields' ); // Create a 'section' for the settings page (Called by each post type) function apspider_setup_sections($section_id, $section_title, $section_callback) { require_once( ABSPATH . 'wp-admin/includes/template.php' ); add_settings_section( $section_id, $section_title, $section_callback, 'apspider_fields' ); } // 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'] ); $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 = $arguments['placeholder']; } else { $placeholder = false ; } printf('
'); switch( $arguments['type'] ){ case 'text': case 'password': case 'number': printf( '', $arguments['uid'], $arguments['type'], $placeholder, $value ); break; case 'textarea': printf( '', $arguments['uid'], $placeholder, $value ); break; case 'select': case 'multiselect': if( ! empty ( $arguments['options'] ) && is_array( $arguments['options'] ) ){ $attributes = ''; $options_markup = ''; foreach( $arguments['options'] as $key => $label ){ if ( isset($arguments['default'][0]) && $label == $arguments['default'][0]) { $options_markup .= sprintf( '', $key, $label); } else { $options_markup .= sprintf( '', $key, $label); } } if( $arguments['type'] === 'multiselect' ){ $attributes = ' multiple="multiple" '; } printf( '', $arguments['uid'], $attributes, $options_markup ); } 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( '
', $arguments['uid'], $arguments['type'], $key, checked( $value[ array_search( $key, $value, true ) ], $key, false ), $label, $iterator ); } printf( '
%s
', $options_markup ); } break; } if( ! empty ( $arguments['helper'] )) { printf( ' %s', $arguments['helper'] ); } // Add a supplemental text field if you ever want to display an additional field if( ! empty ( $arguments['supplemental'] )) { printf( '

%s

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