🐞 fix: Migrate blocks to use helper function for wrapper classes
This commit is contained in:
@@ -31,6 +31,26 @@ function getFieldValue( $field_path ) {
|
||||
return $field;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns wrapper attributes for a block for both preview and front-end contexts.
|
||||
*
|
||||
* @param string $classes Space separated class list.
|
||||
* @param bool $is_preview Whether the block is being previewed in the editor.
|
||||
*
|
||||
* @return string Wrapper attributes ready for output.
|
||||
*/
|
||||
function blockWrapperAttributes( $classes, $is_preview ) {
|
||||
if ( $is_preview ) {
|
||||
return 'class="' . $classes . '"';
|
||||
}
|
||||
|
||||
return get_block_wrapper_attributes(
|
||||
array(
|
||||
'class' => $classes,
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
// Add Global Fields options page.
|
||||
if ( function_exists( 'acf_add_options_page' ) ) {
|
||||
add_action(
|
||||
|
||||
Reference in New Issue
Block a user