'widget_facebook', 'description' => __( 'Display a Facebook Like Box to connect visitors to your Facebook Page', 'bulan' ) ); // Create the widget. parent::__construct( 'bulan-facebook', // $this->id_base __( 'Facebook Like Box', 'bulan' ), // $this->name $widget_options // $this->widget_options ); // Load the facebook page script when the widget is active. if ( is_active_widget( false, false, $this->id_base ) ) { add_action( 'wp_footer', array( $this, 'bulan_facebook_widget_script' ), 10 ); } } /** * 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; } $hide_cover = $instance['hide_cover'] ? 'true' : 'false'; $small_header = $instance['small_header'] ? 'true' : 'false'; $show_face = $instance['show_face'] ? 'true' : 'false'; $show_posts = $instance['show_posts'] ? 'true' : 'false'; echo '
'; 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['url'] = esc_url( $new_instance['url'] ); $instance['hide_cover'] = isset( $new_instance['hide_cover'] ) ? (bool) $new_instance['hide_cover'] : false; $instance['small_header'] = isset( $new_instance['small_header'] ) ? (bool) $new_instance['small_header'] : false; $instance['show_face'] = isset( $new_instance['show_face'] ) ? (bool) $new_instance['show_face'] : false; $instance['show_posts'] = isset( $new_instance['show_posts'] ) ? (bool) $new_instance['show_posts'] : false; 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__( 'Find Us On Facebook', 'bulan' ), 'url' => '', 'hide_cover' => false, 'small_header' => false, 'show_face' => true, 'show_posts' => false, ); $instance = wp_parse_args( (array) $instance, $defaults ); ?>
id="get_field_id( 'hide_cover' ); ?>" name="get_field_name( 'hide_cover' ); ?>" />
id="get_field_id( 'small_header' ); ?>" name="get_field_name( 'small_header' ); ?>" />
id="get_field_id( 'show_face' ); ?>" name="get_field_name( 'show_face' ); ?>" />
id="get_field_id( 'show_posts' ); ?>" name="get_field_name( 'show_posts' ); ?>" />