Or, embed this snippet using GenerateWP WordPress Plugin.

Download

Clone

contact widget

class Contact extends WP_Widget {

	public function __construct() {

		parent::__construct(
			'contact',
			__( 'Contact Widget', 'text_domain' ),
			array(
				'description' => __( 'This is a contact widget', 'text_domain' ),
				'classname'   => 'contact',
			)
		);

	}

	public function widget( $args, $instance ) {

		code

	}

	public function form( $instance ) {

	}

	public function update( $new_instance, $old_instance ) {

	}

}

function custom_contactregister_widgets() {
	register_widget( 'Contact' );
}
add_action( 'widgets_init', 'custom_contactregister_widgets' );