I need to load CSS only if sub_field of flexible fields group is in use on a page template. For example:
$flexable = get_field('flexable_fields');
foreach( $flexable as $item ){
if($item['title']){
wp_enqueue_style('title-styles', get_template_directory_uri() . '/css/style.css', array(), filemtime(get_template_directory() . '/css/title-style.css'), false);
}
}
Which hook I need to use to implement this, "init" or something else? Thanks
The most suitable hook to use would be
wp_enqueue_scripts.