comment_class() – Generates semantic classes for each comment element.
You appear to be a bot. Output may be restricted
Description
Generates semantic classes for each comment element.
Usage
$void|string = comment_class( $css_class, $comment, $post_id, $display );
Parameters
- $css_class
- ( string|string[] ) optional – Optional. One or more classes to add to the class list. Default empty.
- $comment
- ( int|WP_Comment ) optional – Comment ID or WP_Comment object. Default current comment.
- $post_id
- ( int|WP_Post ) optional – Post ID or WP_Post object. Default current post.
- $display
- ( bool ) optional default: 1 – Optional. Whether to print or return the output. Default true.
Returns
void|string Void if $display
argument is true, comment classes if $display
is false.
Source
File name: wordpress/wp-includes/comment-template.php
Lines:
1 to 11 of 11
function comment_class( $css_class = '', $comment = null, $post_id = null, $display = true ) { // Separates classes with a single space, collates classes for comment DIV. $css_class = 'class="' . implode( ' ', get_comment_class( $css_class, $comment, $post_id ) ) . '"'; if ( $display ) { echo $css_class; } else { return $css_class; } }