tag with the final CSS (either inline or media queries)
$style_tag = '';
if ( ! empty( $style ) ) {
$style_tag = sprintf( '', esc_attr( $random_class ), $style );
}
// Output the content wrapped in the div with the random class and padding styles
return $style_tag . sprintf(
'
%s
',
esc_attr( $random_class ),
$content
);
}
/**
* Function to return the media query breakpoint based on the size
*/
function get_media_query_breakpoint( $size ) {
// Define breakpoints for each size
$breakpoints = array(
'extraLarge' => '1200px',
'large' => '1024px',
'medium' => '768px',
'small' => '480px',
);
return isset( $breakpoints[$size] ) ? $breakpoints[$size] : '480px';
}
/**
* Function to initialize the block
*/
function lcp_dynamic_container_block_init() {
register_block_type( __DIR__ . '/build', array(
'render_callback' => 'render_lcp_dynamic_container', // Add the render callback here
));
}
add_action( 'init', 'lcp_dynamic_container_block_init' );