[wp-trac] [WordPress Trac] #45312: parse_blocks return non-existing empty blocks
WordPress Trac
noreply at wordpress.org
Fri Jun 12 07:00:13 UTC 2020
#45312: parse_blocks return non-existing empty blocks
--------------------------+----------------------
Reporter: Chouby | Owner: (none)
Type: defect (bug) | Status: closed
Priority: normal | Milestone:
Component: Editor | Version: 5.0
Severity: normal | Resolution: invalid
Keywords: | Focuses:
--------------------------+----------------------
Comment (by shuok2019):
Use this code
add_filter( 'render_block', function( $content, $block ) {
static $is_even = true;
if ( ! do_I_want_to_modify_this_block( $block ) ) {
return $content;
}
$is_even = ! $is_even;
return sprint(
'<div class="%s">%s</div>',
$is_even ? 'is-even' : 'is-odd',
$content
);
} );
Shared by [mukesh shukla]https://webpositionexpert.com/justdial-extractor/
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45312#comment:11>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list