WC_Product_Cat_List_Walker::display_element( object $element, array $children_elements, int $max_depth, int $depth, array $args, string $output )

Traverse elements to create list from elements.


Description Description

Display one element if the element doesn’t have any children otherwise, display the element and its children. Will only traverse up to the max. depth and no ignore elements under that depth. It is possible to set the. max depth to include all depths, see walk() method.

This method shouldn’t be called directly, use the walk() method instead.


Parameters Parameters

$element

(Required) Data object.

$children_elements

(Required) List of elements to continue traversing.

$max_depth

(Required) Max depth to traverse.

$depth

(Required) Depth of current element.

$args

(Required) Arguments.

$output

(Required) Passed by reference. Used to append additional content.


Top ↑

Return Return

(null) Null on failure with no changes to parameters.


Top ↑

Source Source

File: includes/walkers/class-wc-product-cat-list-walker.php

	public function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
		if ( ! $element || ( 0 === $element->count && ! empty( $args[0]['hide_empty'] ) ) ) {
			return;
		}
		parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
	}

Top ↑

Changelog Changelog

Changelog
Version Description
2.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.