Hi! I'm trying to male my first block and it's working perfect on backend, but on frontend appers nothing. I can't find out why.
Block template:
<?php
echo 'test output';
if ( empty( $attributes['data'] ) ) return;
$data = to_object($attributes['data']);
?>
<?php if ($data->triggers) { ?>
<div class="text-trigger">
<?php foreach ($data->triggers as $trigger) { ?>
<div class="text-trigger__item">
<div class="text-trigger__item-inner">
<div class="text-trigger__item-icon" style="background-image: url(<?= wp_get_attachment_image_url($trigger->icon, 'icon-0x100'); ?>);"></div>
<div class="text-trigger__item-text">
<?= $trigger->text; ?>
</div>
</div>
</div>
<?php } ?>
</div>
<?php } ?>
MetaBox:
<?php
$meta_boxes[] = [
'title' => 'Текстовые триггеры',
'id' => 'text-trigger',
//'description' => 'A custom hero content block',
'type' => 'block',
'icon' => 'awards',
'category' => 'layout',
'context' => 'side',
'render_template' => get_template_directory() . '/gutenberg/text-trigger.php',
'supports' => [
'align' => ['wide', 'full'],
],
'fields' => [
[
'id' => 'triggers',
'type' => 'group',
'name' => 'Контент',
'clone' => true,
'sort_clone' => true,
'add_button' => '+',
'fields' => [
[
'id' => 'icon',
'type' => 'single_image',
'name' => 'Иконка',
],
[
'id' => 'text',
'type' => 'text',
'name' => 'Текст',
],
]
],
],
];