render_block_core_home_link() – Renders the `core/home-link` block.

You appear to be a bot. Output may be restricted

Description

Renders the core/home-link block.

Usage

$string = render_block_core_home_link( $attributes, $content, $block );

Parameters

$attributes
( array ) required – The block attributes.
$content
( string ) required – The saved content.
$block
( WP_Block ) required – The parsed block.

Returns

string Returns the post content with the home url added.

Source

File name: wordpress/wp-includes/blocks/home-link.php


Lines:

1 to 16 of 16
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'] )
  );
}
 

 View on GitHub View on Trac