Core Function
View Source on Trac ↗ comment_class()
comment_class(
mixed $css_class = '',
mixed $comment = null,
mixed $post = null,
mixed $display = true
) Generates semantic classes for each comment element.
Parameters 4 required
| Name / Type | Description |
|---|---|
| mixed | (string | string[]) $css_class Optional. One or more classes to add to the class list. Default empty. Required |
| (int | | WP_Comment) $comment Optional. Comment ID or WP_Comment object. Default current comment. Required |
| (int | | WP_Post) $post Optional. Post ID or WP_Post object. Default current post. Required |
| bool | $display Optional. Whether to print or return the output. Default true. Required |
Return Value
((void)
| string) Void if `$display` argument is true, comment classes if `$display` is false.
Function Information
Since Version
2.7.0
Source File
wp-includes/comment-template.php
Advertisement