Inventory_Presser_KBB_Widget::widget( array $args, array $instance )

Outputs the widget front-end HTML


Parameters Parameters

$args

(array) (Required)

$instance

(array) (Required)


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/widget/class-widget-kbb.php

	public function widget( $args, $instance ) {

		$image_keys = array_keys( $this->images() );
		$image      = ( isset( $instance['image'] ) && in_array( $instance['image'], $image_keys, true ) ) ? $instance['image'] : $image_keys[0];

		$title = apply_filters( 'widget_title', isset( $instance['title'] ) ? $instance['title'] : '' );
		// before and after widget arguments are defined by themes.
		echo $args['before_widget'];
		if ( ! empty( $title ) ) {
			echo $args['before_title'] . $title . $args['after_title'];
		}

		if ( isset( $instance['before_image'] ) ) {
			echo wpautop( $instance['before_image'] );
		}
		printf(
			'<a href="https://kbb.com" target="_blank"><img src="%s"></a>',
			esc_url( plugins_url( '/images/' . $this->images()[ $image ]['img'], INVP_PLUGIN_FILE_PATH ) )
		);
		if ( isset( $instance['after_image'] ) ) {
			echo wpautop( $instance['after_image'] );
		}

		echo $args['after_widget'];
	}