Archived topic
Using register_block_style to create custom styles for core blocks
3 replies · Started by Anastasiya on February 10, 2023
Hi,
Is it possible to use Generatepress Elements to register custom style for one of the core blocks?
I want to add selector of styles for the bullet list core block.
Until now I was using a child theme of GP to add register_block_style in child theme functions.php file. Is it possible to achieve the same functionality without the child theme?
here is sample code if you need it for reference:
add_action('init', function() {
register_block_style('core/list', [
'name' => 'brand-list',
'label' => __('Branded List', 'generatepress'),
]);
});
Hi there,
thats not something you can do with GP Elements.
GP Elements are only for adding content to the front end templates.
That kind of function needs to remain in the Child Theme :)
Thanks for the clarification David.
I'll keep the child theme solution then.
You're welcome