Customise the Youtube block in Gutenberg
-
I’m trying to change what the Youtube block displays. What I want to do is actually a bit more complex than this but I have at least tried to see if this code worked and nothing. Is it possible to customise the Youtube block?
function ree_youtube_player( $block_content, $block ) { if( "core-embed/youtube" === $block['blockName'] ) { $block_content = str_replace( '?feature=oembed', '?feature=oembed&rel=0', $block_content ); } return $block_content; } add_filter( 'render_block', 'ree_youtube_player', 10, 2);
This work for the paragraph block:
function ree_block_paragraph( $block_content, $block ) { if ( $block['blockName'] === 'core/paragraph' ) { $content = '<div class="wp-block-paragraph aaaa">'; $content .= $block_content; $content .= '</div>'; return $content; } return $block_content; } add_filter( 'render_block', 'ree_block_paragraph', 10, 2 );
Thanks ??
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Customise the Youtube block in Gutenberg’ is closed to new replies.