wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



render_block_core_widget_group › WordPress Function

Seit5.9.0
Veraltetn/v
render_block_core_widget_group ( $attributes, $content, $block )
Parameter: (3)
  • (array) $attributes The block attributes.
    Erforderlich: Ja
  • (string) $content The block content.
    Erforderlich: Ja
  • (WP_Block) $block The block.
    Erforderlich: Ja
Gibt zurück:
  • (string) Rendered block.
Definiert in:
Codex:

Renders the 'core/widget-group' block.



Quellcode

function render_block_core_widget_group( $attributes, $content, $block ) {
	global $wp_registered_sidebars, $_sidebar_being_rendered;

	if ( isset( $wp_registered_sidebars[ $_sidebar_being_rendered ] ) ) {
		$before_title = $wp_registered_sidebars[ $_sidebar_being_rendered ]['before_title'];
		$after_title  = $wp_registered_sidebars[ $_sidebar_being_rendered ]['after_title'];
	} else {
		$before_title = '<h2 class="widget-title">';
		$after_title  = '</h2>';
	}

	$html = '';

	if ( ! empty( $attributes['title'] ) ) {
		$html .= $before_title . esc_html( $attributes['title'] ) . $after_title;
	}

	$html .= '<div class="wp-widget-group__inner-blocks">';
	foreach ( $block->inner_blocks as $inner_block ) {
		$html .= $inner_block->render();
	}
	$html .= '</div>';

	return $html;
}