ok thank you, will give this a try, although I need to figure out how to run this code once per day… Would it bog down my site too much you think?
many thanks again,
Andrew
ok, but how could this done manually with a function first ?
I didn’t know I could target [data-name] using CSS..
ok figured this out by using css:
.acf-field-text[data-name="title"], .acf-field-text[data-name="alt"] {display:none;}
ok but the HTML code is wrapped in ACF. I still can’t figure this out 🙁
<tr class="acf-field acf-field-text" data-name="alt" data-type="text">
<td class="acf-label"><label for="attachments-6462-alt">Alt Text</label></td>
<td class="acf-input">
<div class="acf-input-wrap"><input type="text" id="attachments-6462-alt" name="attachments[6462][alt]"></div> </td>
</tr>
Hi,
I couldn’t find anything on this but it should be quite simple.
In each post, I am adding all the images in the gallery field.
Now I would like my authors to be able to insert each image between text using a shortcode like this:
[mygallery image=”1″]
[mygallery image=”2″]
etc…
Any help would be much appreciated!
Hi,
I just upgraded to PRO now. However, fl_image
returns only Image URL, not Image Array.
I suppose if I change this to Image Array, I could get the medium size as you are suggesting. However, I didn’t want to do that in the first place because the array contains unnecessary information.
ok, I have upgraded – for one moment my site went down but now everything seems to work fine. not sure why that happened.
Hi,
I don’t see an option to choose a URL field, only Text, Email, Password.
When I first upload an image to fl_image
, wordpress automatically generates the ‘medium’ version of the image.
For example, at the moment I upload an image to fl_image
with name:
duck.jpg
the version created for ‘medium’ is named:
duck-300×169.jpg
I can’t seem to pass this ‘medium’ file, neither as a URL nor as an image object to an ACF field, with any of the code above..
I think I will buy the PRO version as it’s easier.
How can I upgrade without corrupting my database or losing my existing fields?
I heard some users had problems during upgrades.
many thanks!
such a shame!
I am using Algolia too.. pretty impressive. Looking for a way to make 3 ACF fields being indexed by algolia. Any code handy?
many thanks!
Hi thanks for this,
I am using
function my_acf_save_post( $post_id ) {
// get image id
$image = get_field('fl_image', $post_id);
// set the thumbnail URL field key
$thumbnail_url_field_key = 'fl_afeat';
// set the value of the thumbnail URL field
update_field($thumbnail_url_field_key, $image['sizes']['medium'], $post_id);
}
// run after ACF saves the $_POST['acf'] data
add_action('acf/save_post', 'my_acf_save_post', 20);
but nothing happens when I click on “Update Post”.
Both fields: fl_image and fl_afeat are image fields with the Image URL option set.
What would be wrong?
Hi,
I don’t see this option.. is this a PRO feature?
many thanks
thanks, I am trying to figure out how to incorporate your suggestion on my existing code which is this but I can’t figure it out!
function acf_set_featured_image( $value, $post_id, $field ){
if($value != ''){
//Add the value which is the image ID to the _thumbnail_id meta data for the current post
add_post_meta($post_id, '_thumbnail_id', $value);
}
return $value;
}
// acf/update_value/name={$field_name} - filter for a specific field based on it's name
add_filter('acf/update_value/name=fl_image', 'acf_set_featured_image', 10, 3);
any help would be much appreciated!
Hi, sorry for bringing this issue up again but I the problem here is ACF, not the theme.
When I upload a photo using ACF field, I would like to set the ‘medium’ size being generated for the image, not the full scale image as seen by the code above.
How could I do this please?
yes the code is – works with custom post types too:
<?php
function acf_set_featured_image( $value, $post_id, $field ){
if($value != ''){
//Add the value which is the image ID to the _thumbnail_id meta data for the current post
add_post_meta($post_id, '_thumbnail_id', $value);
}
return $value;
}
// acf/update_value/name={$field_name} - filter for a specific field based on it's name
add_filter('acf/update_value/name=cursusfoto', 'acf_set_featured_image', 10, 3);
?>
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.