Walker_Comment::end_el
Ends the element output, if needed.
Method of the class: Walker_Comment{}
No Hooks.
Returns
null. Nothing (null).
Usage
$Walker_Comment = new Walker_Comment(); $Walker_Comment->end_el( $output, $data_object, $depth, $args );
- $output(string) (required) (passed by reference — &)
- Used to append additional content. Passed by reference.
- $data_object(WP_Comment) (required)
- Comment data object.
- $depth(int)
- Depth of the current comment.
- $args(array)
- An array of arguments.
Default:empty array
Notes
- See: Walker::end_el()
- See: wp_list_comments()
Changelog
| Since 2.7.0 | Introduced. |
| Since 5.9.0 | Renamed $comment to $data_object to match parent class for PHP 8 named parameter support. |
Walker_Comment::end_el() Walker Comment::end el code WP 7.0
public function end_el( &$output, $data_object, $depth = 0, $args = array() ) {
if ( ! empty( $args['end-callback'] ) ) {
ob_start();
call_user_func(
$args['end-callback'],
$data_object, // The current comment object.
$args,
$depth
);
$output .= ob_get_clean();
return;
}
if ( 'div' === $args['style'] ) {
$output .= "</div><!-- #comment-## -->\n";
} else {
$output .= "</li><!-- #comment-## -->\n";
}
}