get_comment_author_url_link()

最后更新于:2021-11-26 08:32:20

get_comment_author_url_link( string$linktext=”, string$before=”, string$after=”, int|GC_Comment$comment)

Retrieves the HTML link of the URL of the author of the current comment.

参数

$linktext

(string) (Optional) The text to display instead of the comment author’s email address.

Default value: ”

$before

(string) (Optional) The text or HTML to display before the email link.

Default value: ”

$after

(string) (Optional) The text or HTML to display after the email link.

Default value: ”

$comment

(int|GC_Comment) (Optional) Comment ID or GC_Comment object. Default is the current comment.

响应

(string) The HTML link between the $before and $after parameters.

源文件

文件: gc-includes/comment-template.php

function get_comment_author_url_link( $linktext = '', $before = '', $after = '', $comment = 0 ) {
	$url     = get_comment_author_url( $comment );
	$display = ( '' !== $linktext ) ? $linktext : $url;
	$display = str_replace( 'http://www.', '', $display );
	$display = str_replace( 'http://', '', $display );

	if ( '/' === substr( $display, -1 ) ) {
		$display = substr( $display, 0, -1 );
	}

	$return = "$before<a href='https://docs.gechiui.com/functions/get_comment_author_url_link/$url' rel='external'>$display</a>$after";

	/**
	 * Filters the comment author's returned URL link.
	 *
	 * @since 1.5.0
	 *
	 * @param string $return The HTML-formatted comment author URL link.
	 */
	return apply_filters( 'get_comment_author_url_link', $return );
}