get_comment_author_url_link() - WordPress 函数参考中文文档

返回介绍

get_comment_author_url_link()

发布于 2017-09-10 字数3058 浏览 867 评论 0

get_comment_author_url_link( string $linktext = '',  string $before = '',  string $after = '',  int|WP_Comment $comment )

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


描述

$linktext parameter is only used if the URL does not exist for the comment author. If the URL does exist then the URL will be used and the $linktext will be ignored.

Encapsulate the HTML link between the $before and $after. So it will appear in the order of $before, link, and finally $after.


参数

$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|WP_Comment)
(Optional)
Comment ID or WP_Comment object. Default is the current comment.


返回值

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


源代码

File: wp-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='$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 );
}

更新日志

Version 描述
4.6.0 Added the $comment parameter.
1.5.0 Introduced.

相关函数

Uses

  • wp-includes/plugin.php:
    apply_filters()
  • wp-includes/comment-template.php:
    get_comment_author_url_link
  • wp-includes/comment-template.php:
    get_comment_author_url()

Used By

  • wp-includes/comment-template.php:
    comment_author_url_link()

User Contributed Notes

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

目前还没有任何评论,快来抢沙发吧!