options = get_option( 'generate_page_header_global_locations' ); ?>

true ), 'objects' ); foreach( $post_types as $type ) { add_settings_field( 'generate_page_header_location_' . $type->name, $type->label, array( $this, 'post_type_select' ), 'page-header-global-locations', 'page_header_cpt_single_section', $type->name ); } $post_types = get_post_types( array( 'public' => true ), 'objects' ); unset( $post_types['attachment'] ); unset( $post_types['page'] ); unset( $post_types['post'] ); if ( count( $post_types ) > 0 ) { add_settings_section( 'page_header_cpt_archives_section', __( 'Post Types - Archives', 'gp-premium' ), '', 'page-header-global-locations' ); } foreach( $post_types as $type ) { add_settings_field( 'generate_page_header_location_' . $type->name . '_archives', $type->label, array( $this, 'post_type_select' ), 'page-header-global-locations', 'page_header_cpt_archives_section', $type->name . '_archives' ); } $taxonomies = get_taxonomies( array( 'public' => true ), 'objects' ); if ( count( $taxonomies ) > 0 ) { add_settings_section( 'page_header_taxonomies_section', __( 'Taxonomies - Archives', 'gp-premium' ), '', 'page-header-global-locations' ); } foreach( $taxonomies as $type ) { add_settings_field( 'generate_page_header_location_' . $type->name, $type->label, array( $this, 'post_type_select' ), 'page-header-global-locations', 'page_header_taxonomies_section', $type->name ); } } /** * Sanitize each setting field as needed * * @param array $input Contains all settings fields as array keys */ public function sanitize( $input ) { // Initialize the new array that will hold the sanitize values $new_input = array(); // Loop through the input and sanitize each of the values if ( is_array( $input ) || is_object( $input ) ) { foreach ( $input as $key => $val ) { $new_input[ $key ] = absint( $val ); } } return $new_input; } /** * Get the settings option array and print one of its values */ public function post_type_select( $type ) { $options = wp_parse_args( get_option( 'generate_page_header_global_locations', array() ), '' ); ?>