wpseek.com
Bazujące na WordPress narzędzie wyszukiwania dla deweloperów i twórców motywów.



block_core_list_render › WordPress Function

Od6.6.0
Przestarzałyn/a
block_core_list_render ( $attributes, $content )
Parametry: (2)
  • (array) $attributes Attributes of the block being rendered.
    Wymagane: Tak
  • (string) $content Content of the block being rendered.
    Wymagane: Tak
Zobacz:
Powrót:
  • (string) The content of the block being rendered.
Zdefiniowane na:
Codex:

Adds the wp-block-list class to the rendered list block.

Ensures that pre-existing list blocks use the class name on the front. For example,
    is transformed to
      .


Źródło

function block_core_list_render( $attributes, $content ) {
	if ( ! $content ) {
		return $content;
	}

	$processor = new WP_HTML_Tag_Processor( $content );

	$list_tags = array( 'OL', 'UL' );
	while ( $processor->next_tag() ) {
		if ( in_array( $processor->get_tag(), $list_tags, true ) ) {
			$processor->add_class( 'wp-block-list' );
			break;
		}
	}

	return $processor->get_updated_html();
}