Home Forums Add-ons Flexible Content Field Check if layout is used Reply To: Check if layout is used

  • You could register your script in functions.php and then enqueue it right where you need. So, just as a mere example:
    in functions.php

    wp_register_script( 'gmaps','', array(), '1.0', true );

    and then in your layout code:

    elseif( get_row_layout() == 'map' ):
            $google_maps = get_sub_field('google_maps');
            if( !empty($google_maps) ):

    This will load google’s .js in footer just when you need it.