Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

acf blocks register block with enqueue script

// ACF Register a testimonial block + enqueue style and js
acf_register_block_type(array(
'name'              => 'testimonial',
'title'             => __('Testimonial'),
'description'       => __('A custom testimonial block.'),
'render_template'   => 'template-parts/blocks/testimonial/testimonial.php',
'category'          => 'formatting',
'render_template'   => get_template_directory() . '/template-parts/blocks/testimonial/testimonial.php',
'enqueue_style'     => get_template_directory_uri() . '/template-parts/blocks/testimonial/testimonial.css',
'enqueue_script'    => get_template_directory_uri() . '/template-parts/blocks/testimonial/testimonial.js'
));
 
PREVIOUS NEXT
Tagged: #acf #blocks #register #block #enqueue #script
ADD COMMENT
Topic
Name
6+6 =