get_comment_author_link example

<<?php echo $tag; ?> <?php comment_class( $this->has_children ? 'parent' : '', $comment ); ?> id="comment-<?php comment_ID(); ?>"> <?php if ( 'div' !== $args['style'] ) : ?> <div id="div-comment-<?php comment_ID(); ?>" class="comment-body"> <?php endif; ?> <div class="comment-author vcard"> <?php             if ( 0 != $args['avatar_size'] ) {
                echo get_avatar( $comment$args['avatar_size'] );
            }
            ?> <?php             $comment_author = get_comment_author_link( $comment );

            if ( '0' == $comment->comment_approved && ! $show_pending_links ) {
                $comment_author = get_comment_author( $comment );
            }

            printf(
                /* translators: %s: Comment author link. */
                __( '%s <span class="says">says:</span>' ),
                sprintf( '<cite class="fn">%s</cite>', $comment_author )
            );
            ?>
<?php if ( ! $comment->comment_type || 'comment' === $comment->comment_type ) : ?> <div class="dashboard-comment-wrap has-row-actions <?php echo $comment_row_class; ?>"> <p class="comment-meta"> <?php                 // Comments might not have a post they relate to, e.g. programmatically created ones.                 if ( $comment_post_link ) {
                    printf(
                        /* translators: 1: Comment author, 2: Post link, 3: Notification if the comment is pending. */
                        __( 'From %1$s on %2$s %3$s' ),
                        '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>',
                        $comment_post_link,
                        '<span class="approve">' . __( '[Pending]' ) . '</span>'
                    );
                } else {
                    printf(
                        /* translators: 1: Comment author, 2: Notification if the comment is pending. */
                        __( 'From %1$s %2$s' ),
                        '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>',
                        '<span class="approve">' . __( '[Pending]' ) . '</span>'
                    );
                }
                
$output .= '<ul id="' . esc_attr( $recent_comments_id ) . '">';
        if ( is_array( $comments ) && $comments ) {
            // Prime cache for associated posts. (Prime post term cache if we need it for permalinks.)             $post_ids = array_unique( wp_list_pluck( $comments, 'comment_post_ID' ) );
            _prime_post_caches( $post_idsstrpos( get_option( 'permalink_structure' ), '%category%' ), false );

            foreach ( (array) $comments as $comment ) {
                $output .= '<li class="recentcomments">';
                $output .= sprintf(
                    /* translators: Comments widget. 1: Comment author, 2: Post link. */
                    _x( '%1$s on %2$s', 'widgets' ),
                    '<span class="comment-author-link">' . get_comment_author_link( $comment ) . '</span>',
                    '<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . get_the_title( $comment->comment_post_ID ) . '</a>'
                );
                $output .= '</li>';
            }
        }
        $output .= '</ul>';

        if ( 'html5' === $format ) {
            $output .= '</nav>';
        }

        
/** * Displays the HTML link to the URL of the author of the current comment. * * @since 0.71 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. * * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to print the author's link. * Default current comment. */
function comment_author_link( $comment_id = 0 ) {
    echo get_comment_author_link( $comment_id );
}

/** * Retrieves the IP address of the author of the current comment. * * @since 1.5.0 * @since 4.4.0 Added the ability for `$comment_id` to also accept a WP_Comment object. * * @param int|WP_Comment $comment_id Optional. WP_Comment or the ID of the comment for which to get the author's IP address. * Default current comment. * @return string Comment author's IP address, or an empty string if it's not available. */
Home | Imprint | This part of the site doesn't use cookies.