WC_Widget_Brand_Thumbnails::widget()
Echoes the widget content.
Метод класса: WC_Widget_Brand_Thumbnails{}
Хуки из метода
Возвращает
null
. Ничего (null).
Использование
$WC_Widget_Brand_Thumbnails = new WC_Widget_Brand_Thumbnails(); $WC_Widget_Brand_Thumbnails->widget( $args, $instance );
- $args(массив) (обязательный)
- Display arguments including 'before_title', 'after_title', 'before_widget', and 'after_widget'.
- $instance(массив) (обязательный)
- The settings for the particular instance of the widget.
Заметки
- Смотрите: WP_Widget
Код WC_Widget_Brand_Thumbnails::widget() WC Widget Brand Thumbnails::widget WC 9.4.2
public function widget( $args, $instance ) { $instance = wp_parse_args( $instance, array( 'title' => '', 'columns' => 1, 'exclude' => '', 'orderby' => 'name', 'hide_empty' => 0, 'number' => '', ) ); $exclude = array_map( 'intval', explode( ',', $instance['exclude'] ) ); $order = 'name' === $instance['orderby'] ? 'asc' : 'desc'; $brands = get_terms( array( 'taxonomy' => 'product_brand', 'hide_empty' => $instance['hide_empty'], 'orderby' => $instance['orderby'], 'exclude' => $exclude, 'number' => $instance['number'], 'order' => $order, ) ); if ( ! $brands ) { return; } /** * Filter the widget's title. * * @since 9.4.0 * * @param string $title Widget title * @param array $instance The settings for the particular instance of the widget. * @param string $woo_widget_idbase The widget's id base. */ $title = apply_filters( 'widget_title', $instance['title'], $instance, $this->woo_widget_idbase ); echo $args['before_widget']; // phpcs:ignore WordPress.Security.EscapeOutput if ( '' !== $title ) { echo $args['before_title'] . $title . $args['after_title']; // phpcs:ignore WordPress.Security.EscapeOutput } wc_get_template( 'widgets/brand-thumbnails.php', array( 'brands' => $brands, 'columns' => (int) $instance['columns'], 'fluid_columns' => ! empty( $instance['fluid_columns'] ) ? true : false, ), 'woocommerce', WC()->plugin_path() . '/templates/brands/' ); echo $args['after_widget']; // phpcs:ignore WordPress.Security.EscapeOutput }