Yeah I thought as much..
I’ve had a thought about how I can achieve this via the UI.
I have at the moment a field group called Blocks and it’s being cloned into a flexible content field.
I’m thinking I will have two seperate field groups, Parent Blocks and Child Blocks, with the child blocks being empty.
I assume the parent will be overwritten the second I save the child blocks field group and it will merge the two together in the flexible content clone.
I might mess about with making the parent blocks being private, I’ve not tested that.
I’m not sure why it isn’t working but you should be able to trouble shoot it easily..
Are you using a number field or a text field. It would be best to use number and not evaluate your arguments using “string”, as it might return false.
Print_r(get_field(‘field_name’);
see what values are being outputted and work from there.
If the script is the same every time. You could add it to the code for the page and wrap it in an IF statement. Use a true false field to turn it on an off..
The code would be
<?php if(get_field(‘field_name’):?>
…copy script here
<?php endif;?>
If you want to manually add different scripts then make a TextArea field and input it into that.