Skip to content

Instantly share code, notes, and snippets.

@joniahola
Created September 23, 2019 12:17
Show Gist options
  • Save joniahola/c7d4ee5431889287183c12ca0f73dcdb to your computer and use it in GitHub Desktop.
Save joniahola/c7d4ee5431889287183c12ca0f73dcdb to your computer and use it in GitHub Desktop.
core block muokkaus
<?php
add_filter( 'render_block', 'my_wrap_quote_block_fitler', 10, 3);
function my_wrap_quote_block_fitler( $block_content, $block ) {
$listOfExtraContainer = [
'core/paragraph',
'core/image',
'core/heading',
'core/gallery',
'core/list',
'core/quote',
'core/shortcode',
'core/archives',
'core/audio',
'core/button',
'core/calendar',
'core/categories',
'core/code',
'core/columns',
//'core/column',
'core/cover',
'core/embed',
'core/file',
'core/group',
'core/html',
'core/mediaText',
'core/latestComments',
'core/latestPosts',
'core/missing',
'core/more',
'core/nextpage',
'core/preformatted',
'core/pullquote',
'core/rss',
'core/search',
'core/separator',
'core/reusableBlock',
'core/socialLinks',
'core/spacer',
'core/subhead',
'core/table',
'core/tagCloud',
'core/textColumns',
'core/verse',
'core/video'
];
if(!in_array($block['blockName'], $listOfExtraContainer)) {
return $block_content;
}
$classes = 'container ' . str_replace('core/', '', $block['blockName']);
$output = '<div class="' . $classes . '">';
$output .= $block_content;
$output .= '</div>';
return $output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment