'widget-beginner-social widget_social_icons', 'description' => __( 'Display your social media icons.', 'beginner' ) ); // Create the widget. parent::__construct( 'beginner-social', // $this->id_base __( '» Social Icons', 'beginner' ), // $this->name $widget_options // $this->widget_options ); } /** * Outputs the widget based on the arguments input through the widget controls. * * @since 1.0.0 */ function widget( $args, $instance ) { extract( $args ); // Output the theme's $before_widget wrapper. echo $before_widget; // If the title not empty, display it. if ( $instance['title'] ) { echo $before_title . apply_filters( 'widget_title', $instance['title'], $instance, $this->id_base ) . $after_title; } // Display the social icons. echo '
'; // Close the theme's widget wrapper. echo $after_widget; } /** * Updates the widget control options for the particular instance of the widget. * * @since 1.0.0 */ function update( $new_instance, $old_instance ) { $instance = $new_instance; $instance['title'] = strip_tags( $new_instance['title'] ); $instance['facebook'] = esc_url( $new_instance['facebook'] ); $instance['twitter'] = esc_url( $new_instance['twitter'] ); $instance['gplus'] = esc_url( $new_instance['gplus'] ); $instance['pinterest'] = esc_url( $new_instance['pinterest'] ); $instance['linkedin'] = esc_url( $new_instance['linkedin'] ); $instance['instagram'] = esc_url( $new_instance['instagram'] ); $instance['tumblr'] = esc_url( $new_instance['tumblr'] ); $instance['rss'] = esc_url( $new_instance['rss'] ); return $instance; } /** * Displays the widget control options in the Widgets admin screen. * * @since 1.0.0 */ function form( $instance ) { // Default value. $defaults = array( 'title' => esc_html__( 'Follow us', 'beginner' ), 'facebook' => '', 'twitter' => '', 'gplus' => '', 'pinterest' => '', 'linkedin' => '', 'instagram' => '', 'tumblr' => '', 'rss' => '' ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>