The list of widget is stored in an option named ‘sidebars_widgets’. A var_export() may give something like the following:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | /** * Super simple widget. */ class T5_Demo_Widget extends WP_Widget { public function __construct() { // id_base , visible name parent::__construct( 't5_demo_widget', 'T5 Demo Widget' ); } public function widget( $args, $instance ) { echo $args['before_widget'], wpautop( $instance['text'] ), $args['after_widget']; } public function form( $instance ) { $text = isset ( $instance['text'] ) ? esc_textarea( $instance['text'] ) : ''; printf( '<textarea class="widefat" rows="7" cols="20" id="%1$s" name="%2$s">%3$s</textarea>', $this->get_field_id( 'text' ), $this->get_field_name( 'text' ), $text ); } } |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.