" . esc_html($attributes['heading']) . "{$heading_tag}>";
// Create the
list and populate it with the key points
$output = $heading; // Start with the heading
$output .= '';
foreach ($key_points as $point) {
// Avoid empty points
if (!empty($point)) {
$output .= '- ' . esc_html($point) . '
';
}
}
$output .= '
';
return $output;
}
// Register the block
function register_key_points_block() {
register_block_type(__DIR__ . '/build', [
'editor_script' => 'key-points-editor-script', // Script for the editor
'render_callback' => 'render_key_points_block', // PHP callback for frontend rendering
]);
}
add_action('init', 'register_key_points_block');