Inventory_Presser_Order_By_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-order-by.php

	public function widget( $args, $instance ) {

		wp_enqueue_script( 'order-by-widget-javascript' );
		$title = apply_filters( 'widget_title', ( isset( $instance['title'] ) ? $instance['title'] : '' ) );

		$keys_to_list = explode( '|', $instance['post-meta-keys'] );
		if ( 0 < count( $keys_to_list ) ) {
			echo $args['before_widget'];
			if ( $title ) {
				echo $args['before_title'] . $title . $args['after_title'];
			}
			echo '<ul class="order-by-list list-nostyle">';
			foreach ( $keys_to_list as $key ) {
				echo '<li><a href="javascript:order_by_post_meta(\'' . esc_attr( $key ) . '\');">'
				. esc_html( isset( $instance[ 'label-' . $key ] ) ? $instance[ 'label-' . $key ] : $key )
				. '</a></li>';
			}
			echo '</ul>' . $args['after_widget'];
		}
	}