I’m having trouble too, I’ve tried the suggested stuff on wordpress.org which seems to be to use wp_register_script
instead of wp_enqueue_script
– the difference being that it registers it but doesnt load it. Then you call it within the block.json file referencing the handle see here
So add your wp_register_script
in a enqueue_block_editor_assets
action eg.
add_action( 'enqueue_block_editor_assets', function(){
wp_register_script( 'block-qb-daterange', get_template_directory_uri() . '/script-url-here.js', array(''), null, true );
});
then in block.json you can use script
for global (front and admin) or editorScript
key for just loading into the editor, basically anything on that link earlier
{
"script": "block-qb-daterange",
}
I have been having a look and found some extended functionality within pro/assets/js/acf-pro-input.js
that allows you to return layouts and some other things. What I can’t understand though is how to programmatically add the sub-fields.
I want to pre-populate certain post types or templates with field. I thought I could add a .js file to the post.php page within admin, that runs some of the acf API functionality but I can’t understand how to add values to a field.
Anybody had any luck with this?
Is there a fix for this yet? I’ve tried updating to 5.4.2 and using all the fixes here but no luck
Worked like an absolute charm, you my sir are a legend, thanks.
No worries @elliot, I think it could be some issue with the php configuration on the server. It is a customised server setup by a sysadmin and could therefore have some settings that don’t play well.
Thanks for the reply though.
Are you getting any errors in the console?
It sounds like a javascript error to me.
I am on Mac and works fine in Safari, Chrome and Firefox.
What version of Safari, ACF etc
I have had this problem and i think it’s a multisite-only issue as it doesn’t do it on single installations.
It depends upon how you are saving the data for the illustrations_image field.
Have a look and see if it’s Image Object, Image URL or Image ID
Think you will probably have to use Image ID (which is the attachment ID in the database) then use the following:
wp_get_attachment_image_src – for the source file and dimensions
wp_get_attachment_image_attributes – for attributes eg. title, caption, alt
Is it within a loop? Don’t think get_field will work unless it’s within a loop?
Test it by doing print_r($rows) before foreach, see what you get
Sorry Elliot i don’t think i’m explaining myself correctly but it doesn’t matter as i bought your brilliant Flexible Content Field which has allowed me to make different areas.
Hi @Elliot
I didn’t mean the popup library, i mean actually on my acf repeater field.
I have the three different sized items in my select (1×1,2×1,1×2) that i am using on the front-end but on the repeater item, i have an image field that i can only select one preview image from.
The problem i have is that when the user will select say the 2×1 landscape size they are shown a thumbnail on the preview image.
Thanks
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Cookie Policy. If you continue to use this site, you consent to our use of cookies.