comment_class example

$children = $comment->get_children();

        /* * We need to create the CSS classes BEFORE recursing into the children. * This is because comment_class() uses globals like `$comment_alt` * and `$comment_thread_alt` which are order-sensitive. * * The `false` parameter at the end means that we do NOT want the function * to `echo` the output but to return a string. * See https://developer.wordpress.org/reference/functions/comment_class/#parameters. */
        $comment_classes = comment_class( '', $comment->comment_ID, $comment->comment_post_ID, false );

        // If the comment has children, recurse to create the HTML for the nested         // comments.         if ( ! empty( $children ) && ! empty( $thread_comments ) ) {
            if ( $comment_depth < $thread_comments_depth ) {
                ++$comment_depth;
                $inner_content  = block_core_comment_template_render_comments(
                    $children,
                    $block
                );
                $block_content .= sprintf( '<ol>%1$s</ol>', $inner_content );
                


            if ( 'view' === $action && '1' !== $comment->comment_approved ) {
                $action .= ' hidden';
            }

            $actions_string .= "<span class='$action'>{$separator}{$link}</span>";
        }
    }
    ?> <li id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status( $comment ) )$comment ); ?>> <?php             $comment_row_class = '';

            if ( get_option( 'show_avatars' ) ) {
                echo get_avatar( $comment, 50, 'mystery' );
                $comment_row_class .= ' has-avatar';
            }
            ?> <?php if ( ! $comment->comment_type || 'comment' === $comment->comment_type ) : ?>

    protected function ping( $comment$depth$args ) {
        $tag = ( 'div' === $args['style'] ) ? 'div' : 'li';
        ?> <<?php echo $tag; ?> id="comment-<?php comment_ID(); ?>" <?php comment_class( '', $comment ); ?>> <div class="comment-body"> <?php _e( 'Pingback:' ); ?> <?php comment_author_link( $comment ); ?> <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?> </div> <?php     }

    /** * Filters the comment text. * * Removes links from the pending comment's text if the commenter did not consent * to the comment cookies. * * @since 5.4.2 * * @param string $comment_text Text of the current comment. * @param WP_Comment|null $comment The comment object. Null if not found. * @return string Filtered text of the current comment. */
Home | Imprint | This part of the site doesn't use cookies.