Home Forums Gutenberg different renderings according to front and back-office


different renderings according to front and back-office

  • Hello there !
    (I’m french so I gonna try to be explicit)

    I’m working on a project where I have to create gutenbergs blocks using ACF.

    Basically I want to create a block that has a preview in the back office (a simple title for example) and an html rendering on my template page.

    What I did is that I called render_template (for my template page) and render_callback(for the back-office). But it only takes in count render_callback both for my back-office and template :

    add_action('acf/init', 'my_acf_init_block_types');
    function my_acf_init_block_types() {
        // Check function exists.
        if( function_exists('acf_register_block_type') ) {
            // register a testimonial block.
                'name'              => 'section_main_home',
                'title'             => __('Section principale'),
                'description'       => __('Section principale de la page d\'acceuil.'),
                'render_template'   => 'template-parts/blocks/home/section_main_home.php',
                'category'          => 'custom-blocks-peb',
                'icon'              => 'schedule',
                'mode'              => 'auto',
                'render_callback'   => 'my_acf_block_render_callback',
                'enqueue_style'     => get_template_directory_uri() . '/css/blocks.css',
                'keywords'          => array( 'section_main_home', 'main', 'home', 'section' ),

    How can I have front and back-office with two different renderings ?

    Thanks for your replies !

    • chhotes

    • January 7, 2021 at 6:20 pm

    Udupi cafe, Chhotes , Biryani Maxx

  • What is front and back office systems?

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.