WC_Brands::output_product_brand_thumbnails()publicWC 1.0

Displays brand thumbnails.

Метод класса: WC_Brands{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$WC_Brands = new WC_Brands();
$WC_Brands->output_product_brand_thumbnails( $atts );
$atts(разное) (обязательный)
-

Код WC_Brands::output_product_brand_thumbnails() WC 9.4.2

public function output_product_brand_thumbnails( $atts ) {
	$args = shortcode_atts(
		array(
			'show_empty'    => true,
			'columns'       => 4,
			'hide_empty'    => 0,
			'orderby'       => 'name',
			'exclude'       => '',
			'number'        => '',
			'fluid_columns' => false,
		),
		$atts
	);

	$exclude = array_map( 'intval', explode( ',', $args['exclude'] ) );
	$order   = 'name' === $args['orderby'] ? 'asc' : 'desc';

	if ( 'true' === $args['show_empty'] ) {
		$hide_empty = false;
	} else {
		$hide_empty = true;
	}

	$brands = get_terms(
		'product_brand',
		array(
			'hide_empty' => $hide_empty,
			'orderby'    => $args['orderby'],
			'exclude'    => $exclude,
			'number'     => $args['number'],
			'order'      => $order,
		)
	);

	if ( ! $brands ) {
		return;
	}

	if ( $hide_empty ) {
		$brands = $this->remove_terms_with_empty_products( $brands );
	}

	ob_start();

	wc_get_template(
		'widgets/brand-thumbnails.php',
		array(
			'brands'        => $brands,
			'columns'       => is_numeric( $args['columns'] ) ? intval( $args['columns'] ) : 4,
			'fluid_columns' => wp_validate_boolean( $args['fluid_columns'] ),
		),
		'woocommerce',
		WC()->plugin_path() . '/templates/brands/'
	);

	return ob_get_clean();
}