Inventory_Presser_KBB_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-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 wp_kses_post( $args['before_widget'] );
if ( ! empty( $title ) ) {
echo wp_kses_post( $args['before_title'] ) . esc_html( $title ) . wp_kses_post( $args['after_title'] );
}
if ( isset( $instance['before_image'] ) ) {
echo wp_kses_post( 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 wp_kses_post( wpautop( $instance['after_image'] ) );
}
echo wp_kses_post( $args['after_widget'] );
}
Expand full source codeCollapse full source codeView on Github