Code
Explorer
You are a developer and looking for Shopware projects?
Apply Now!
get_comment_author_url example
array
(
'class' => 'wp-block-latest-comments__comment-avatar',
)
)
;
if
(
$avatar
)
{
$list_items_markup
.=
$avatar
;
}
}
$list_items_markup
.= '<article>';
$list_items_markup
.= '<footer class="wp-block-latest-comments__comment-meta">';
$author_url
=
get_comment_author_url
(
$comment
)
;
if
(
empty
(
$author_url
)
&& !
empty
(
$comment
->user_id
)
)
{
$author_url
=
get_author_posts_url
(
$comment
->user_id
)
;
}
$author_markup
= '';
if
(
$author_url
)
{
$author_markup
.= '<a class="wp-block-latest-comments__comment-author" href="' .
esc_url
(
$author_url
)
. '">' .
get_comment_author
(
$comment
)
. '</a>';
}
else
{
$author_markup
.= '<span class="wp-block-latest-comments__comment-author">' .
get_comment_author
(
$comment
)
. '</span>';
}
else
{
/* translators: Comment author title. %s: Comment author name. */
printf
(
ent2ncr
(
__
(
'By: %s'
)
)
,
get_comment_author_rss
(
)
)
;
}
?> </title> <link rel="alternate" href="<?php
comment_link
(
)
; ?>" type="<?php
bloginfo_rss
(
'html_type'
)
; ?>" /> <author> <name><?php
comment_author_rss
(
)
; ?></name> <?php
if
(
get_comment_author_url
(
)
)
{
echo
'<uri>' .
get_comment_author_url
(
)
. '</uri>';
}
?> </author> <id><?php
comment_guid
(
)
; ?></id> <updated><?php
echo
mysql2date
(
'Y-m-d\TH:i:s\Z',
get_comment_time
(
'Y-m-d H:i:s', true, false
)
, false
)
; ?></updated> <published><?php
echo
mysql2date
(
'Y-m-d\TH:i:s\Z',
get_comment_time
(
'Y-m-d H:i:s', true, false
)
, false
)
; ?></published> <?php
if
(
post_password_required
(
$comment_post
)
)
: ?>
$classes
= array
(
)
;
if
(
isset
(
$attributes
[
'textAlign'
]
)
)
{
$classes
[
]
= 'has-text-align-' .
$attributes
[
'textAlign'
]
;
}
if
(
isset
(
$attributes
[
'style'
]
[
'elements'
]
[
'link'
]
[
'color'
]
[
'text'
]
)
)
{
$classes
[
]
= 'has-link-color';
}
$wrapper_attributes
=
get_block_wrapper_attributes
(
array
(
'class' =>
implode
(
' ',
$classes
)
)
)
;
$comment_author
=
get_comment_author
(
$comment
)
;
$link
=
get_comment_author_url
(
$comment
)
;
if
(
!
empty
(
$link
)
&& !
empty
(
$attributes
[
'isLink'
]
)
&& !
empty
(
$attributes
[
'linkTarget'
]
)
)
{
$comment_author
=
sprintf
(
'<a rel="external nofollow ugc" href="%1s" target="%2s" >%3s</a>',
esc_url
(
$link
)
,
esc_attr
(
$attributes
[
'linkTarget'
]
)
,
$comment_author
)
;
}
if
(
'0' ===
$comment
->comment_approved && !
$show_pending_links
)
{
$comment_author
=
wp_kses
(
$comment_author
, array
(
)
)
;
}
return
sprintf
(
'<div %1$s>%2$s</div>',
$wrapper_attributes
,
<?php
_e
(
'Author'
)
; ?></th> <td><?php
comment_author
(
$comment
)
; ?></td> </tr> <?php
if
(
get_comment_author_email
(
$comment
)
)
{
?> <tr> <th scope="row"><?php
_e
(
'Email'
)
; ?></th> <td><?php
comment_author_email
(
$comment
)
; ?></td> </tr> <?php
}
?> <?php
if
(
get_comment_author_url
(
$comment
)
)
{
?> <tr> <th scope="row"><?php
_e
(
'URL'
)
; ?></th> <td><a href="<?php
comment_author_url
(
$comment
)
; ?>"><?php
comment_author_url
(
$comment
)
; ?></a></td> </tr> <?php
}
?> <tr> <th scope="row"><?php /* translators: Column name or table row header. */
_e
(
'In response to'
)
; ?></th> <td> <?php
$post_id
=
$comment
->comment_post_ID;
if
(
current_user_can
(
'edit_post',
$post_id
)
)
{
function
get_comment_author_link
(
$comment_id
= 0
)
{
$comment
=
get_comment
(
$comment_id
)
;
$comment_id
= !
empty
(
$comment
->comment_ID
)
?
$comment
->comment_ID :
(string)
$comment_id
;
$comment_author_url
=
get_comment_author_url
(
$comment
)
;
$comment_author
=
get_comment_author
(
$comment
)
;
if
(
empty
(
$comment_author_url
)
|| 'http://' ===
$comment_author_url
)
{
$comment_author_link
=
$comment_author
;
}
else
{
$rel_parts
= array
(
'ugc'
)
;
if
(
!
wp_is_internal_link
(
$comment_author_url
)
)
{
$rel_parts
=
array_merge
(
$rel_parts
,
array
(
'external', 'nofollow'
)
)
;
}
}
}
/** * @global string $comment_status * * @param WP_Comment $comment The comment object. */
public
function
column_author
(
$comment
)
{
global
$comment_status
;
$author_url
=
get_comment_author_url
(
$comment
)
;
$author_url_display
=
untrailingslashit
(
preg_replace
(
'|^http(s)?://(www\.)?|i', '',
$author_url
)
)
;
if
(
strlen
(
$author_url_display
)
> 50
)
{
$author_url_display
=
wp_html_excerpt
(
$author_url_display
, 49, '…'
)
;
}
echo
'<strong>';
comment_author
(
$comment
)
;
echo
'</strong><br />';