Home › Forums › Gutenberg › Adding Block Styles to an ACF Custom Block › Reply To: Adding Block Styles to an ACF Custom Block
Adding the ‘sytles’ attribute worked for me. On the front-end if you want the style classes to show up on the HTML, you can use the $block['className']
global variable.
$className = 'acf-card';
if( !empty($block['className']) ) {
$className .= ' ' . $block['className'];
}
I found this in the blocks documentation under “3. Render the Block”
https://www.advancedcustomfields.com/resources/blocks/
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.