Hello,
I’m working on a site where I want to open a modal with ajax to display some part of a post. In this part of the post there is an ACF block but, the CSS does not load 🙁
I work with fancybox.
Here is the code of the block template:
acf_register_block(array(
'name' => 'mentor-fa',
'title' => __('Profil du mentor', 'frassu'),
'category' => 'ad-blocks-2',
'icon' => 'superhero-alt',
'mode' => 'auto',
'supports' => array(
'align' => false,
'mode' => false,
),
'keywords' => array( 'mentor' ),
'render_template' => FS_THEME_DIR . '/blocks/block-mentor/templates/block-mentor-template.php',
'enqueue_assets' => function() {
wp_enqueue_style( 'block-mentor', FS_THEME_URL . '/blocks/block-mentor/css/block-mentor.css' );
},
));
Is there something to add to the block? Or a callback in the facnybox init JS?
Thanks !
Why are you using functions to enqueue the style, use the JSON style decalaration. Or try putting the wp_enqueue_style call into the template. It’s also not clear to me why you’re using a function to call the template rather than a JSON declaration.
Other than that (these should work anyway), check that the CSS file exists by interrogating the src parameter.
Thank you and sorry I’m using the “old fashion not json” way to use ACF blocks…
The CSS file exist because there are no issue on the single post, only when the post is loaded in the modal window.
I guess a callbak is needed after the modal init