diff --git a/inc/custom-blocks.php b/inc/custom-blocks.php new file mode 100644 index 0000000..8ea0583 --- /dev/null +++ b/inc/custom-blocks.php @@ -0,0 +1,56 @@ +loadHTML( $block_content ); + $table = $doc->getElementsByTagName( 'table' ); + $table[0]->setAttribute( 'class', 'uk-table' ); + + $output = $doc->saveHTML(); + + return $output; +} +add_filter( 'render_block', 'teamwpugph_table_block_fitler', 10, 3 ); + +/** + * Quote block filter + */ +function teamwpugph_quote_block_fitler( $block_content, $block ) { + + if ( 'core/quote' !== $block['blockName'] ) { + return $block_content; + } + + $html = new DOMDocument(); + $html->loadHTML( $block_content ); + $p = $html->getElementsByTagName( 'p' ); + $cite = $html->getElementsByTagName( 'cite' ); + + $output = '
'; + $output .= '

'; + $output .= $p[0]->nodeValue; + $output .= '

'; + $output .= ''; + $output .= '
'; + + return $output; + +} +add_filter( 'render_block', 'teamwpugph_quote_block_fitler', 10, 3 );