
网络开发中的Git:了解一个项目的典型工作流程
render_block_core_home_link ( $attributes, $content, $block )
render_block_core_home_link: 这个函数用来渲染WordPress中的主页链接块。主页链接块允许用户添加一个链接到他们网站的主页: 这个函数负责生成主页链接块的HTML标记。
渲染`core/home-link`区块。
function render_block_core_home_link( $attributes, $content, $block ) { if ( empty( $attributes['label'] ) ) { return ''; } $aria_current = is_home() || ( is_front_page() && 'page' === get_option( 'show_on_front' ) ) ? ' aria-current="page"' : ''; return sprintf( '<li %1$s><a class="wp-block-home-link__content wp-block-navigation-item__content" href="%2$s" "rel="home"%3$s>%4$s</a></li>', block_core_home_link_build_li_wrapper_attributes( $block->context ), esc_url( home_url() ), $aria_current, wp_kses_post( $attributes['label'] ) ); }