Answer the question
In order to leave comments, you need to log in
How to add custom classes to standard Gutenberg elements?
Primitive elements are rendered in their pure form, without any classes, such as Paragraph:
or List:<p>тут какой то текст</p>
<ul>
<li>текст пункта<li>
</ul>
Answer the question
In order to leave comments, you need to log in
add_filter('render_block', 'wrapBlock', 10, 2);
function wrapBlock($block_content, $block)
{
$name = $block['blockName'];
if ($name)
{
return sprintf('<div class="e-block e-block-%s">%s</div>', str_replace('/', '-', $name), $block_content);
}
return $block_content;
}
When you select any standard element, then in the right sidebar (where the record settings are displayed) there is a "Block" tab. There, in the "Additional" drop-down block, you can specify the classes you need.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question