WC_Brands::output_product_brand_thumbnails_description()publicWC 1.0

Displays brand thumbnails description.

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

Хуков нет.

Возвращает

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

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

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

Код WC_Brands::output_product_brand_thumbnails_description() WC 9.4.2

public function output_product_brand_thumbnails_description( $atts ) {
	$args = shortcode_atts(
		array(
			'show_empty' => true,
			'columns'    => 1,
			'hide_empty' => 0,
			'orderby'    => 'name',
			'exclude'    => '',
			'number'     => '',
		),
		$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' => $args['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-description.php',
		array(
			'brands'  => $brands,
			'columns' => $args['columns'],
		),
		'woocommerce',
		WC()->plugin_path() . '/templates/brands/'
	);

	return ob_get_clean();
}