ACF blocks works in backed, but frontend 'null'

Hi,

I hope i am writing this on the right place :slight_smile:

I want to create a block with ACF, and so far it’s working in the backend, it gets renderd and i see the value. But if i want to communicate this to the front-end i get null.

as example, a simple title. Let me explain what i did so far: See code.

What is also strange and i dont get, when i var_dump $block or $title i get notting in return (front-end). In the back-end i see the information?! Does it has something to do with the render_callback and template?! I hope some one can explain this in dummy style, so i know what i did wrong :smiley:

functions.php

add_action('acf/init', 'my_acf_register_blocks');
function my_acf_register_blocks() {
    // Check if ACF is active
    if (function_exists('acf_register_block_type')) {
        // Register a custom block
        acf_register_block_type(array(
            'name'              => 'plainheader',
            'title'             => __('Plain Header'),
            'description'       => __('Plain Header'),
            'render_callback'   => 'render_plainheader_block',
            'render_template'   =>  get_template_directory() . '/resources/views/blocks/plainheader/plainheader.blade.php',
            'enqueue_style' => get_template_directory_uri() . '/resources/styles/app.css',
            'category'          => 'media',
            'icon'              => 'images-alt2',

        ));
    }
}

function render_plainheader_block($block) {
    $fields = get_fields(); // Get all ACF fields
    echo \Roots\view('blocks.plainheader.plainheader', [
        'block' => $block,
        'fields' => $fields,
    ]);
}

plainheader.blade.php( i cropped the code to only the title btw)

@php

/**
 * Plainheader Block Template.
 *
 * @param   array $block The block settings and attributes.
 * @param   string $content The block inner HTML (empty).
 * @param   bool $is_preview True during AJAX preview.
 * @param   (int|string) $post_id The post ID this block is saved to.
 */

 $id = $block['id'] ?? 'plainheader';
if (!empty($block['anchor'])) {
    $id = $block['anchor'];
}

$className = 'plainheader';
if (!empty($block['className'])) {
    $className .= ' ' . $block['className'];
}
if (!empty($block['align'])) {
    $className .= ' align' . $block['align'];
}
$title = get_field('title');
@endphp
<section id="{{ $id }}" class="{{ $className }}">

  <div class="container">
    <div class="lg:grid grid-cols-2 block relative">
      
        <div class="header_title">
          {{ $title }}
        </div>

      </div>

okay, above is okay.

I figured out i was using a custom template and forgot to add:

 @include('partials.content-page')