BP_Walker_Category_Checklist::start_el( string $output, object $category, int $depth, array $args = array(), int $id )
Start the element output.
Description
Parameters
- $output
-
(Required) Passed by reference. Used to append additional content.
- $category
-
(Required) The current term object.
- $depth
-
(Required) Depth of the term in reference to parents. Default 0.
- $args
-
(Optional) An array of arguments.
Default value: array()
- $id
-
(Required) ID of the current term.
Source
File: bp-core/classes/class-bp-walker-category-checklist.php
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | public function start_el( & $output , $category , $depth = 0, $args = array (), $id = 0 ) { if ( empty ( $args [ 'taxonomy' ] ) ) { $taxonomy = 'category' ; } else { $taxonomy = $args [ 'taxonomy' ]; } if ( $taxonomy == 'category' ) { $name = 'post_category' ; } else { $name = 'tax_input[' . $taxonomy . ']' ; } $args [ 'popular_cats' ] = empty ( $args [ 'popular_cats' ] ) ? array () : $args [ 'popular_cats' ]; $class = in_array( $category ->term_id, $args [ 'popular_cats' ] ) ? ' class="popular-category"' : '' ; $args [ 'selected_cats' ] = empty ( $args [ 'selected_cats' ] ) ? array () : $args [ 'selected_cats' ]; if ( ! empty ( $args [ 'list_only' ] ) ) { $aria_cheched = 'false' ; $inner_class = 'category' ; if ( in_array( $category ->term_id, $args [ 'selected_cats' ] ) ) { $inner_class .= ' selected' ; $aria_cheched = 'true' ; } /** This filter is documented in wp-includes/category-template.php */ $output .= "\n" . '<li' . $class . '>' . '<div class="' . $inner_class . '" data-term-id=' . $category ->term_id . ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' . esc_html( apply_filters( 'the_category' , $category ->description ) ) . '</div>' ; } else { /** This filter is documented in wp-includes/category-template.php */ $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . '<label for="in-' . $taxonomy . '-' . $category ->term_id . '" class="selectit"><input value="' . $category ->slug . '" type="checkbox" name="' . $name . '[]" id="in-' . $taxonomy . '-' . $category ->term_id . '"' . checked( in_array( $category ->term_id, $args [ 'selected_cats' ] ), true, false ) . disabled( empty ( $args [ 'disabled' ] ), false, false ) . ' /> ' . esc_html( apply_filters( 'the_category' , $category ->description ) ) . '</label>' ; } } |
Questions?
We're always happy to help with code or other questions you might have! Search our developer docs, contact support, or connect with our sales team.