WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Платформа для конвертации и монетизации трафика
функция не описана

WP_Block::render() public WP 5.5.0

Generates the render output for the block.

{} Это метод класса: WP_Block{}

Хуки из метода
Возвращает

Строку. Rendered block output.

Использование

$WP_Block = new WP_Block();
$WP_Block->render( $options );
$options(массив)

Optional options object.

  • dynamic(true/false)
    Defaults to 'true'. Optionally set to false to avoid using the block's render_callback.

По умолчанию: array()

Список изменений

С версии 5.5.0 Введена.

Код WP_Block::render() WP 5.5.3

<?php
public function render( $options = array() ) {
	global $post;
	$options = wp_parse_args(
		$options,
		array(
			'dynamic' => true,
		)
	);

	$is_dynamic    = $options['dynamic'] && $this->name && null !== $this->block_type && $this->block_type->is_dynamic();
	$block_content = '';

	if ( ! $options['dynamic'] || empty( $this->block_type->skip_inner_blocks ) ) {
		$index = 0;
		foreach ( $this->inner_content as $chunk ) {
			$block_content .= is_string( $chunk ) ?
				$chunk :
				$this->inner_blocks[ $index++ ]->render();
		}
	}

	if ( $is_dynamic ) {
		$global_post   = $post;
		$block_content = (string) call_user_func( $this->block_type->render_callback, $this->attributes, $block_content, $this );
		$post          = $global_post;
	}

	if ( ! empty( $this->block_type->script ) ) {
		wp_enqueue_script( $this->block_type->script );
	}

	if ( ! empty( $this->block_type->style ) ) {
		wp_enqueue_style( $this->block_type->style );
	}

	/**
	 * Filters the content of a single block.
	 *
	 * @since 5.0.0
	 *
	 * @param string $block_content The block content about to be appended.
	 * @param array  $block         The full block, including name and attributes.
	 */
	return apply_filters( 'render_block', $block_content, $this->parsed_block );
}