wpseek.com
Outil de recherche WordPress pour les développeurs et auteurs de thèmes
block_core_heading_render › WordPress Function
Depuisn/a
Dépréciéen/a
› block_core_heading_render ( $attributes, $content )
Paramètres: (2) |
|
Retourne: |
|
Défini(e) dans: |
|
Codex: |
Adds a wp-block-heading class to the heading block content.
For example, the following block content:Hello World
Would be transformed to:Hello World
Source
function block_core_heading_render( $attributes, $content ) { if ( ! $content ) { return $content; } $p = new WP_HTML_Tag_Processor( $content ); $header_tags = array( 'H1', 'H2', 'H3', 'H4', 'H5', 'H6' ); while ( $p->next_tag() ) { if ( in_array( $p->get_tag(), $header_tags, true ) ) { $p->add_class( 'wp-block-heading' ); break; } } return $p->get_updated_html(); }