Separate block render template for post editor and website front
-
Hi,
I’m using ACF in order to generate new block. Here I’ve a button that call the file
template-parts/blocks/button.php
as render template :add_action('acf/init', 'rt_block_button'); function rt_block_button() { if( function_exists('acf_register_block') ) { acf_register_block(array( 'title' => __( 'Bouton', 'rt' ), 'name' => 'button', 'category' => 'rt', 'keywords' => array( 'button', 'bouton', 'kmc', 'finance' ), 'mode' => 'preview', 'render_template' => 'template-parts/blocks/button.php', 'icon' => 'button' )); } }
My question is pretty simple : Is it possible to separate the block’s render template depending on if we’re on post editor (back-office) or the front website ?
I already tried to contextualize the template output directly by using the
get_current_screen()
function, but this last one always returns “null”. I don’t know if it is still usefull since 5.0 and Gutenberg and so.Thank you in advance.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Separate block render template for post editor and website front’ is closed to new replies.