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

widget


Description Description

Outputs the widget front-end HTML


Top ↑

Parameters Parameters

$args

(array) (Required)

$instance

(array) (Required)


Top ↑

Return Return

(void)


Top ↑

Source Source

File: includes/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)) ? $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="%s" target="_blank"><img src="%s"></a>','http://kbb.com',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'];
	}