Support

Account

Home Forums Backend Issues (wp-admin) Unable to preview ACF Block

Unread

Unable to preview ACF Block

  • Hi,

    I want to enable the preview mode from the back-office of my edit pages to have a faithful rendering of my ACF blocks on the back-office. I documented myself about how it works, I enabled preview mode in the acf_register_block_type() function but once I switch from edit mode to preview mode, nothing is displayed. In the code inspector, only the div named acf-block-preview appears but this one is empty. I’m having trouble seeing what’s wrong with my code.

    Have you ever encountered a similar situation?

    Here’s my code :

    <?php
        acf_register_block_type(array(
            'name'              => 'Bloc Chiffres clés',
            'title'             => __('Bloc Chiffres clés'),
            'description'       => __('Affiche un bloc s\'inspirant de la mise en page "Chiffres clés".'),
            'render_template'   => 'templates/blocks/'.basename(__DIR__).'/'.basename(__DIR__).'-render.php',
            'category'          => 'formating',
            'mode'	=> 'preview',
            'supports'		=> [
                'align'			=> true,
                'anchor'		=> true,
                'customClassName'	=> true,
                'jsx' 			=> true,
            ],
            'keywords'          => array( 'chiffres', 'clés', 'number', 'block', 'bloc' ),
    
        ));

    Thanks !

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.