get_comment_excerpt example


function comment_excerpt( $comment_id = 0 ) {
    $comment = get_comment( $comment_id );

    $comment_excerpt = get_comment_excerpt( $comment );

    /** * Filters the comment excerpt for display. * * @since 1.2.0 * @since 4.1.0 The `$comment_id` parameter was added. * * @param string $comment_excerpt The comment excerpt text. * @param string $comment_id The comment ID as a numeric string. */
    echo apply_filters( 'comment_excerpt', $comment_excerpt$comment->comment_ID );
}


            if ( $attributes['displayDate'] ) {
                $list_items_markup .= sprintf(
                    '<time datetime="%1$s" class="wp-block-latest-comments__comment-date">%2$s</time>',
                    esc_attr( get_comment_date( 'c', $comment ) ),
                    date_i18n( get_option( 'date_format' )get_comment_date( 'U', $comment ) )
                );
            }
            $list_items_markup .= '</footer>';
            if ( $attributes['displayExcerpt'] ) {
                $list_items_markup .= '<div class="wp-block-latest-comments__comment-excerpt">' . wpautop( get_comment_excerpt( $comment ) ) . '</div>';
            }
            $list_items_markup .= '</article></li>';
        }
    }

    $classnames = array();
    if ( $attributes['displayAvatar'] ) {
        $classnames[] = 'has-avatars';
    }
    if ( $attributes['displayDate'] ) {
        $classnames[] = 'has-dates';
    }
Home | Imprint | This part of the site doesn't use cookies.