true ), 'objects' ); foreach ( $post_types as $post_type => $object ) { if ( 'attachment' === $post_type ) { continue; } add_settings_field( 'prepend_' . $post_type, '', array( $this, 'prepend_html' ), 'writing', 'apporprep_section', array( 'post_type' => $post_type ) ); add_settings_field( 'append_' . $post_type, '', array( $this, 'append_html' ), 'writing', 'apporprep_section', array( 'post_type' => $post_type ) ); add_settings_field( 'display_in_archive_' . $post_type, '', array( $this, 'display_in_archive' ), 'writing', 'apporprep_section', array( 'post_type' => $post_type ) ); add_settings_field( 'apporprep_separator_' . $post_type, '', array( $this, 'separator' ), 'writing', 'apporprep_section' ); register_setting( 'writing', 'prepend_' . $post_type, array( $this, 'validate' ) ); register_setting( 'writing', 'append_' . $post_type, array( $this, 'validate' ) ); register_setting( 'writing', 'display_in_archive_' . $post_type, array( $this, 'validate_display' ) ); } } /** * Display the header text */ public function header_html() { ?>


true, 'media_buttons' => true, 'textarea_rows' => 8, 'teeny' => true, ) ); } /** * Render display in archive option. * * @param array $args arguments. */ public function display_in_archive( $args ) { $post_type = $args['post_type']; $value = absint( get_option( 'display_in_archive_' . $post_type, 1 ) ); ?> value="1"> true, 'media_buttons' => true, 'textarea_rows' => 8, 'teeny' => true, ) ); } /** * Validate the append or prepend setting. * * @param string $value Content value. * * @return string */ public function validate( $value ) { $value = wp_kses( $value, wp_kses_allowed_html( 'post' ) ); return $value; } /** * Validate the display in archive option. * * @param string $value new value. * * @return int */ public function validate_display( $value ) { return absint( $value ); } }