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?
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.
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
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.
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.
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!
© 2021 Advanced Custom Fields. Subscribe