WordPress at Your Fingertips
function is not described

WC_Product_Cat_Dropdown_Walker::start_el() public WC 2.1.0

Starts the list before the elements are added.

{} It's a method of the class: WC_Product_Cat_Dropdown_Walker{}

Hooks from the method

Return

null. Nothing.

Usage

$WC_Product_Cat_Dropdown_Walker = new WC_Product_Cat_Dropdown_Walker();
$WC_Product_Cat_Dropdown_Walker->start_el( $output, $cat, $depth, $args, $current_object_id );
$output(string) (required) (passed by reference — &)
Passed by reference. Used to append additional content.
$cat(object) (required)
Category.
$depth(int)
Depth of category in reference to parents.
$args(array)
Arguments.
Default: array()
$current_object_id(int)
Current object ID.

Notes

Changelog

Since 2.1.0 Introduced.

Code of WC_Product_Cat_Dropdown_Walker::start_el() WC 5.9.0

public function start_el( &$output, $cat, $depth = 0, $args = array(), $current_object_id = 0 ) {

	if ( ! empty( $args['hierarchical'] ) ) {
		$pad = str_repeat( ' ', $depth * 3 );
	} else {
		$pad = '';
	}

	$cat_name = apply_filters( 'list_product_cats', $cat->name, $cat );
	$value    = ( isset( $args['value'] ) && 'id' === $args['value'] ) ? $cat->term_id : $cat->slug;
	$output  .= "\t<option class=\"level-$depth\" value=\"" . esc_attr( $value ) . '"';

	if ( $value === $args['selected'] || ( is_array( $args['selected'] ) && in_array( $value, $args['selected'], true ) ) ) {
		$output .= ' selected="selected"';
	}

	$output .= '>';
	$output .= esc_html( $pad . $cat_name );

	if ( ! empty( $args['show_count'] ) ) {
		$output .= '&nbsp;(' . absint( $cat->count ) . ')';
	}

	$output .= "</option>\n";
}