函数
get_comment_author_url_link ( $linktext = '', $before = '', $after = '', $comment = 0 )
- 参数
-
-
(string)
$linktext
Optional. The text to display instead of the comment author’s email address. Default empty.- Required: 否
- Default: (empty)
-
(string)
$before
Optional. The text or HTML to display before the email link. Default empty.- Required: 否
- Default: (empty)
-
(string)
$after
Optional. The text or HTML to display after the email link. Default empty.- Required: 否
- Default: (empty)
-
(int|WP_Comment)
$comment
Optional. Comment ID or WP_Comment object. Default is the current comment.- Required: 否
-
(string)
- 返回值
-
- (string) The HTML link between the $before and $after parameters.
- 定义位置
-
-
wp-includes/comment-template.php
, line 379
-
wp-includes/comment-template.php
- 引入
- 1.5.0
- 弃用
- –
检索当前评论的作者的URL的HTML链接。
$linktext参数只在评论作者的URL不存在时使用。如果URL确实存在,那么将使用该URL,$linktext将被忽略。
将HTML链接封装在$before和$after之间。所以它将以$before、link、最后$after的顺序出现。
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$display$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 );
}
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。