Inventory_Presser_Order_By_Widget::widget( array $args, array $instance )
Outputs the widget front-end HTML
On This Page
Parameters Parameters
- $args
-
(array) (Required)
- $instance
-
(array) (Required)
Return Return
(void)
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']; } }
Expand full source codeCollapse full source codeView on Github