'att_youtube', 'description' => __('Display a YouTube video')); $control_ops = array(); $this->WP_Widget('att_youtube', __('ATT YouTube'), $widget_ops, $control_ops); } // Display the widget on the web site function widget( $args, $instance ) { extract($args); // Optionally generate the link code echo $before_widget; ?>
'att_youtube_title', 'content' => 'att_youtube_content' ); $submit = 'att_youtube_submit'; // Read in existing option value from database $opt_val = array( 'title' => get_option( $opt_name['title']) , 'content' => get_option( $opt_name['content']) ); // See if the user has posted us some information // If they did, this hidden field will be set to 'Save' if(isset($_POST[ $submit ]) && $_POST[ $submit ] == 'Save' ) { // Read their posted value $opt_val = array( 'title' => stripslashes($_POST[ $opt_name['title'] ]), 'content' => stripslashes($_POST[ $opt_name['content'] ]) ); // Save the posted value in the database update_option( $opt_name['title'], $opt_val['title'] ); update_option( $opt_name['content'], $opt_val['content'] ); // Put an options updated message on the screen ?>