编辑:avatar.php
<?php /** * Server-side rendering of the `core/avatar` block. * * @package WordPress */ /** * Renders the `core/avatar` block on the server. * * @since 6.0.0 * * @param array $attributes Block attributes. * @param string $content Block default content. * @param WP_Block $block Block instance. * @return string Return the avatar. */ function render_block_core_avatar( $attributes, $content, $block ) { $size = isset( $attributes['size'] ) ? $attributes['size'] : 96; $wrapper_attributes = get_block_wrapper_attributes(); $border_attributes = get_block_core_avatar_border_attributes( $attributes ); // Class gets passed through `esc_attr` via `get_avatar`. $image_classes = ! empty( $border_attributes['class'] ) ? "wp-block-avatar__image {$border_attributes['class']}" : 'wp-block-avatar__image'; // Unlike class, `get_avatar` doesn't filter the styles via `esc_attr`. // The style engine does pass the border styles through // `safecss_filter_attr` however. $image_styles = ! empty( $border_attributes['style'] ) ? sprintf( ' style="%s"', esc_attr( $border_attributes['style'] ) ) : ''; if ( ! isset( $block->context['commentId'] ) ) { if ( isset( $attributes['userId'] ) ) { $author_id = $attributes['userId']; } elseif ( isset( $block->context['postId'] ) ) { $author_id = get_post_field( 'post_author', $block->context['postId'] ); } else { $author_id = get_query_var( 'author' ); } if ( empty( $author_id ) ) { return ''; } $author_name = get_the_author_meta( 'display_name', $author_id ); // translators: %s: Author name. $alt = sprintf( __( '%s Avatar' ), $author_name ); $avatar_block = get_avatar( $author_id, $size, '', $alt, array( 'extra_attr' => $image_styles, 'class' => $image_classes, ) ); if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) { $label = ''; if ( '_blank' === $attributes['linkTarget'] ) { // translators: %s is the Author name. $label = 'aria-label="' . esc_attr( sprintf( __( '(%s author archive, opens in a new tab)' ), $author_name ) ) . '"'; } // translators: 1: Author archive link. 2: Link target. %3$s Aria label. %4$s Avatar image. $avatar_block = sprintf( '<a href="%1$s" target="%2$s" %3$s class="wp-block-avatar__link">%4$s</a>', esc_url( get_author_posts_url( $author_id ) ), esc_attr( $attributes['linkTarget'] ), $label, $avatar_block ); } return sprintf( '<div %1s>%2s</div>', $wrapper_attributes, $avatar_block ); } $comment = get_comment( $block->context['commentId'] ); if ( ! $comment ) { return ''; } /* translators: %s: Author name. */ $alt = sprintf( __( '%s Avatar' ), $comment->comment_author ); $avatar_block = get_avatar( $comment, $size, '', $alt, array( 'extra_attr' => $image_styles, 'class' => $image_classes, ) ); if ( isset( $attributes['isLink'] ) && $attributes['isLink'] && isset( $comment->comment_author_url ) && '' !== $comment->comment_author_url ) { $label = ''; if ( '_blank' === $attributes['linkTarget'] ) { // translators: %s: Comment author name. $label = 'aria-label="' . esc_attr( sprintf( __( '(%s website link, opens in a new tab)' ), $comment->comment_author ) ) . '"'; } $avatar_block = sprintf( '<a href="%1$s" target="%2$s" %3$s class="wp-block-avatar__link">%4$s</a>', esc_url( $comment->comment_author_url ), esc_attr( $attributes['linkTarget'] ), $label, $avatar_block ); } return sprintf( '<div %1s>%2s</div>', $wrapper_attributes, $avatar_block ); } /** * Generates class names and styles to apply the border support styles for * the Avatar block. * * @since 6.3.0 * * @param array $attributes The block attributes. * @return array The border-related classnames and styles for the block. */ function get_block_core_avatar_border_attributes( $attributes ) { $border_styles = array(); $sides = array( 'top', 'right', 'bottom', 'left' ); // Border radius. if ( isset( $attributes['style']['border']['radius'] ) ) { $border_styles['radius'] = $attributes['style']['border']['radius']; } // Border style. if ( isset( $attributes['style']['border']['style'] ) ) { $border_styles['style'] = $attributes['style']['border']['style']; } // Border width. if ( isset( $attributes['style']['border']['width'] ) ) { $border_styles['width'] = $attributes['style']['border']['width']; } // Border color. $preset_color = array_key_exists( 'borderColor', $attributes ) ? "var:preset|color|{$attributes['borderColor']}" : null; $custom_color = $attributes['style']['border']['color'] ?? null; $border_styles['color'] = $preset_color ? $preset_color : $custom_color; // Individual border styles e.g. top, left etc. foreach ( $sides as $side ) { $border = $attributes['style']['border'][ $side ] ?? null; $border_styles[ $side ] = array( 'color' => isset( $border['color'] ) ? $border['color'] : null, 'style' => isset( $border['style'] ) ? $border['style'] : null, 'width' => isset( $border['width'] ) ? $border['width'] : null, ); } $styles = wp_style_engine_get_styles( array( 'border' => $border_styles ) ); $attributes = array(); if ( ! empty( $styles['classnames'] ) ) { $attributes['class'] = $styles['classnames']; } if ( ! empty( $styles['css'] ) ) { $attributes['style'] = $styles['css']; } return $attributes; } /** * Registers the `core/avatar` block on the server. * * @since 6.0.0 */ function register_block_core_avatar() { register_block_type_from_metadata( __DIR__ . '/avatar', array( 'render_callback' => 'render_block_core_avatar', ) ); } add_action( 'init', 'register_block_core_avatar' );
保存文件
位置:
home
/
robertofarias
/
public_html
/
wp-includes
/
blocks
批量上传
创建
创建
批量权限
批量删除
名称
权限
大小
修改时间
操作
↑ 返回上级
-
-
-
-
accordion
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
accordion-heading
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
accordion-item
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
accordion-panel
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
archives
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
audio
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
avatar
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
block
drwxr-xr-x
-
2024-07-17 11:52
权限
删除
重命名
button
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
buttons
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
calendar
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
categories
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
code
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
column
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
columns
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comment-author-name
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
comment-content
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comment-date
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
comment-edit-link
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
comment-reply-link
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
comment-template
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comments
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comments-pagination
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comments-pagination-next
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comments-pagination-numbers
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comments-pagination-previous
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
comments-title
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
cover
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
details
drwxr-xr-x
-
2023-08-09 11:43
权限
删除
重命名
embed
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
file
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
footnotes
drwxr-xr-x
-
2023-08-09 11:43
权限
删除
重命名
freeform
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
gallery
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
group
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
heading
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
home-link
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
html
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
image
drwxr-xr-x
-
2023-11-08 10:55
权限
删除
重命名
latest-comments
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
latest-posts
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
legacy-widget
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
list
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
list-item
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
loginout
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
math
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
media-text
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
missing
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
more
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
navigation
drwxr-xr-x
-
2023-11-08 10:55
权限
删除
重命名
navigation-link
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
navigation-submenu
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
nextpage
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
page-list
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
page-list-item
drwxr-xr-x
-
2023-03-30 09:26
权限
删除
重命名
paragraph
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
pattern
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
post-author
drwxr-xr-x
-
2025-12-04 05:42
权限
删除
重命名
post-author-biography
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
post-author-name
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
post-comments-count
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
post-comments-form
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
post-comments-link
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
post-content
drwxr-xr-x
-
2025-04-16 11:06
权限
删除
重命名
post-date
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
post-excerpt
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
post-featured-image
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
post-navigation-link
drwxr-xr-x
-
2023-03-30 09:26
权限
删除
重命名
post-template
drwxr-xr-x
-
2025-04-16 11:06
权限
删除
重命名
post-terms
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
post-time-to-read
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
post-title
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
preformatted
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
pullquote
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query
drwxr-xr-x
-
2024-04-03 10:16
权限
删除
重命名
query-no-results
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query-pagination
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query-pagination-next
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query-pagination-numbers
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query-pagination-previous
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query-title
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
query-total
drwxr-xr-x
-
2025-04-16 11:06
权限
删除
重命名
quote
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
read-more
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
rss
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
search
drwxr-xr-x
-
2023-08-09 11:43
权限
删除
重命名
separator
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
shortcode
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
site-logo
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
site-tagline
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
site-title
drwxr-xr-x
-
2023-03-30 09:26
权限
删除
重命名
social-link
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
social-links
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
spacer
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
table
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
tag-cloud
drwxr-xr-x
-
2024-11-13 13:00
权限
删除
重命名
template-part
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
term-count
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
term-description
drwxr-xr-x
-
2023-08-09 11:43
权限
删除
重命名
term-name
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
term-template
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
terms-query
drwxr-xr-x
-
2025-12-04 05:41
权限
删除
重命名
text-columns
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
verse
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
video
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
widget-group
drwxr-xr-x
-
2022-11-15 19:03
权限
删除
重命名
accordion-item.php
-rw-r--r--
2.35 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
accordion.php
-rw-r--r--
1.12 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
archives.php
-rw-r--r--
4.31 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
avatar.php
-rw-r--r--
5.61 KB
2024-11-13 13:00
编辑
下载
权限
删除
重命名
blocks-json.php
-rw-r--r--
213.43 KB
2026-02-27 10:54
编辑
下载
权限
删除
重命名
button.php
-rw-r--r--
1.71 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
calendar.php
-rw-r--r--
5.93 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
categories.php
-rw-r--r--
4.54 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
comment-author-name.php
-rw-r--r--
2.08 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
comments-pagination-next.php
-rw-r--r--
1.88 KB
2024-11-13 13:00
编辑
下载
权限
删除
重命名
comments-pagination-numbers.php
-rw-r--r--
1.59 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
comments-pagination-previous.php
-rw-r--r--
1.75 KB
2024-11-13 13:00
编辑
下载
权限
删除
重命名
comments-pagination.php
-rw-r--r--
1.23 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
comments-title.php
-rw-r--r--
2.71 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
cover.php
-rw-r--r--
3.1 KB
2025-04-16 11:06
编辑
下载
权限
删除
重命名
error_log
-rw-r--r--
26.36 KB
2026-04-02 20:32
编辑
下载
权限
删除
重命名
footnotes.php
-rw-r--r--
3.68 KB
2024-04-03 10:16
编辑
下载
权限
删除
重命名
gallery.php
-rw-r--r--
6.29 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
heading.php
-rw-r--r--
1.27 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
home-link.php
-rw-r--r--
5.31 KB
2025-04-16 11:06
编辑
下载
权限
删除
重命名
index.php
-rw-r--r--
4.99 KB
2024-11-13 13:00
编辑
下载
权限
删除
重命名
latest-comments.php
-rw-r--r--
4.91 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
legacy-widget.php
-rw-r--r--
3.92 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
list.php
-rw-r--r--
1.24 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
loginout.php
-rw-r--r--
1.63 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
media-text.php
-rw-r--r--
4.28 KB
2024-11-13 13:00
编辑
下载
权限
删除
重命名
page-list-item.php
-rw-r--r--
361 B
2024-07-17 11:51
编辑
下载
权限
删除
重命名
page-list.php
-rw-r--r--
13.29 KB
2024-11-13 13:00
编辑
下载
权限
删除
重命名
pattern.php
-rw-r--r--
1.75 KB
2025-04-16 11:06
编辑
下载
权限
删除
重命名
post-author-biography.php
-rw-r--r--
1.49 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
post-author-name.php
-rw-r--r--
1.91 KB
2025-05-01 11:02
编辑
下载
权限
删除
重命名
post-author.php
-rw-r--r--
2.67 KB
2025-05-01 11:02
编辑
下载
权限
删除
重命名
post-comments-form.php
-rw-r--r--
2.74 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
post-comments-link.php
-rw-r--r--
2.18 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
post-content.php
-rw-r--r--
2.29 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
post-excerpt.php
-rw-r--r--
3.53 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
post-featured-image.php
-rw-r--r--
9.14 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
post-navigation-link.php
-rw-r--r--
4.72 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
post-template.php
-rw-r--r--
5.61 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
post-terms.php
-rw-r--r--
3.55 KB
2025-04-16 11:06
编辑
下载
权限
删除
重命名
post-time-to-read.php
-rw-r--r--
6.34 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
query-no-results.php
-rw-r--r--
1.8 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
query-pagination-next.php
-rw-r--r--
3.69 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
query-pagination-numbers.php
-rw-r--r--
4.66 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
query-pagination-previous.php
-rw-r--r--
3.49 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
query-pagination.php
-rw-r--r--
1.15 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
query-title.php
-rw-r--r--
2.87 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
query-total.php
-rw-r--r--
2.48 KB
2025-04-16 11:06
编辑
下载
权限
删除
重命名
query.php
-rw-r--r--
5.56 KB
2025-04-16 11:06
编辑
下载
权限
删除
重命名
require-dynamic-blocks.php
-rw-r--r--
4.59 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
rss.php
-rw-r--r--
4.5 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
search.php
-rw-r--r--
23.26 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
shortcode.php
-rw-r--r--
735 B
2024-07-17 11:51
编辑
下载
权限
删除
重命名
site-logo.php
-rw-r--r--
6.19 KB
2024-11-13 13:00
编辑
下载
权限
删除
重命名
site-tagline.php
-rw-r--r--
1.17 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名
site-title.php
-rw-r--r--
1.82 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
social-link.php
-rw-r--r--
66.15 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
tag-cloud.php
-rw-r--r--
1.55 KB
2024-11-13 13:00
编辑
下载
权限
删除
重命名
term-count.php
-rw-r--r--
1.8 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
term-description.php
-rw-r--r--
1.73 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
term-name.php
-rw-r--r--
2.02 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
term-template.php
-rw-r--r--
4.41 KB
2026-02-27 10:54
编辑
下载
权限
删除
重命名
video.php
-rw-r--r--
2.67 KB
2025-12-04 05:41
编辑
下载
权限
删除
重命名
widget-group.php
-rw-r--r--
2.38 KB
2024-07-17 11:51
编辑
下载
权限
删除
重命名