WC_Product_Cat_List_Walker::start_el()publicWC 2.1.0

Start the element output.

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

Хуки из метода

Возвращает

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

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

$WC_Product_Cat_List_Walker = new WC_Product_Cat_List_Walker();
$WC_Product_Cat_List_Walker->start_el( $output, $cat, $depth, $args, $current_object_id );
$output(строка) (обязательный) (передается по ссылке — &)
Passed by reference. Used to append additional content.
$cat(объект) (обязательный)
Category.
$depth(int)
Depth of category in reference to parents.
$args(массив)
Arguments.
По умолчанию: array()
$current_object_id(int)
Current object ID.

Заметки

Список изменений

С версии 2.1.0 Введена.

Код WC_Product_Cat_List_Walker::start_el() WC 8.7.0

public function start_el( &$output, $cat, $depth = 0, $args = array(), $current_object_id = 0 ) {
	$cat_id = intval( $cat->term_id );

	$output .= '<li class="cat-item cat-item-' . $cat_id;

	if ( $args['current_category'] === $cat_id ) {
		$output .= ' current-cat';
	}

	if ( $args['has_children'] && $args['hierarchical'] && ( empty( $args['max_depth'] ) || $args['max_depth'] > $depth + 1 ) ) {
		$output .= ' cat-parent';
	}

	if ( $args['current_category_ancestors'] && $args['current_category'] && in_array( $cat_id, $args['current_category_ancestors'], true ) ) {
		$output .= ' current-cat-parent';
	}

	$output .= '"><a href="' . get_term_link( $cat_id, $this->tree_type ) . '">' . apply_filters( 'list_product_cats', $cat->name, $cat ) . '</a>';

	if ( $args['show_count'] ) {
		$output .= ' <span class="count">(' . $cat->count . ')</span>';
	}
}