Support

Account

Home Forums Gutenberg No rendering in front end

Unread

No rendering in front end

    • PaulG

    • August 5, 2020 at 12:10 am

    Hi !

    I tried to register a block with acf as followed:

    add_action('acf/init', 'bwb_content_gallery');
    function bwb_content_gallery() {
    
       // Check function exists.
    	if( function_exists('acf_register_block_type') ) {
    
    		// register a testimonial block.
    		acf_register_block_type(array(
    			'name'              => 'bwb_gallery',
    			'title'             => __('Galerie Lexuberance'),
    			'description'       => __(''),
    			'render_callback'   => 'acf_render_callback',
    			'category'          => 'formating',
    			'icon'              => 'schedule',
    			'keywords'          => array( 'gallery', 'lexuberance' ),
    			'mode'				  => 'edit'
    		));
    	}
    }

    To have a rendering I used ‘render_template’ as first but nothing appears in front-end.
    To avoid any path issues with my template I decided to use ‘render_callback’ then.

    function acf_render_callback( $block, $content = "", $is_preview = false, $post_id = 0 ) {
    	?>
    	<p>RENDERING</p>
    	<?php
    }
    

    “RENDERING” is showing in the editor but nothing in front-end.

    Am I missing something ? How to render my block in front-end ?

Viewing 1 post (of 1 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.