WP_Widget_Custom_HTML::form() WordPress Method

The WP_Widget_Custom_HTML::form() method allows you to display a custom HTML form for the widget. This can be used to create a custom control for the widget.

WP_Widget_Custom_HTML::form( array $instance ) #

Outputs the Custom HTML widget settings form.


Description

Top ↑

See also


Top ↑

Parameters

$instance

(array)(Required)Current instance.


Top ↑

Source

File: wp-includes/widgets/class-wp-widget-custom-html.php

	public function form( $instance ) {
		$instance = wp_parse_args( (array) $instance, $this->default_instance );
		?>
		<input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" class="title sync-input" type="hidden" value="<?php echo esc_attr( $instance['title'] ); ?>" />
		<textarea id="<?php echo $this->get_field_id( 'content' ); ?>" name="<?php echo $this->get_field_name( 'content' ); ?>" class="content sync-input" hidden><?php echo esc_textarea( $instance['content'] ); ?></textarea>
		<?php
	}


Top ↑

Changelog

Changelog
VersionDescription
4.9.0The form contains only hidden sync inputs. For the control UI, see WP_Widget_Custom_HTML::render_control_template_scripts().
4.8.1Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.