WC_Widget_Brand_Description::widget()publicWC 1.0

Echoes the widget content.

Method of the class: WC_Widget_Brand_Description{}

No Hooks.

Return

null. Nothing (null).

Usage

$WC_Widget_Brand_Description = new WC_Widget_Brand_Description();
$WC_Widget_Brand_Description->widget( $args, $instance );
$args(array) (required)
Display arguments including 'before_title', 'after_title', 'before_widget', and 'after_widget'.
$instance(array) (required)
The settings for the particular instance of the widget.

Notes

WC_Widget_Brand_Description::widget() code WC 9.5.1

public function widget( $args, $instance ) {
	extract( $args ); // phpcs:ignore WordPress.PHP.DontExtract.extract_extract

	if ( ! is_tax( 'product_brand' ) ) {
		return;
	}

	if ( ! get_query_var( 'term' ) ) {
		return;
	}

	$thumbnail = '';
	$term      = get_term_by( 'slug', get_query_var( 'term' ), 'product_brand' );

	$thumbnail = wc_get_brand_thumbnail_url( $term->term_id, 'large' );

	echo $before_widget . $before_title . $term->name . $after_title; // phpcs:ignore WordPress.Security.EscapeOutput

	wc_get_template(
		'widgets/brand-description.php',
		array(
			'thumbnail' => $thumbnail,
			'brand'     => $term,
		),
		'woocommerce',
		WC()->plugin_path() . '/templates/brands/'
	);

	echo $after_widget; // phpcs:ignore WordPress.Security.EscapeOutput
}