I have a options page I made using ACF in the backend, which is called contact, for now it holds just the a repeater called ‘social_media’ within that I have 2 sub fields ‘social_media_logo’ and ‘social_media_link’, I have then added in all the social media options I wanted e.g facebook, twitter etc etc but then I found when I wanted to change the image for one of the sub fields, I can’t unless I remove the social media row e.g facebook, and then re-add it, is there no other way I can update the social media image without doing this?
I am using ACF Pro 5.2.8 and wordpress 4.2.3
Currently you must delete the current image and then select a new one. There isn’t a “Replace”. To be honest, I actually don’t know much about what the developer plans in the future. I just know a bit about how it work and I help out here on the forum. I know that it’s worked the way it does not for as long as I can remember.
I can flag this topic for his attention. He may have more input.
OK thanks, I don’t know if this is related to the above, but I deleted the image as you mentioned and added another, but the new image isn’t being reflected on the front-end, I have gone as far as renaming the group name (not group label) and as it was a repeater, the sub names (not sub labels) and I am still having the same issue.
Perhaps I am doing something wrong or is this a bug?
No caching plugin, I don’t like those when I am developing websites.
Here is the code:
<?php if(get_field('social_media_section')): ?> <?php while(the_repeater_field('social_media_section')): ?> <a href="<?php the_sub_field( "social_media_image_link" ); ?>" target="_blank"><img src="<?php the_sub_field( "social_media_image" ); ?>" /></a> <?php endwhile; ?> <?php endif; ?>
It did work yesterday but then I went and deleted a image and since then it stopped working. If you need admin access I can provide that, or FTP info as its on a site in development.
the_repeater_field() could be part of the problem, it has been deprecated for a while. I’ve actually never used it. http://www.advancedcustomfields.com/resources/the_repeater_field/
Try using http://www.advancedcustomfields.com/resources/has_sub_field/ or http://www.advancedcustomfields.com/resources/have_rows/ and see if it clears up the problem.
OK I have just tried both of those and nothing appears, I even deleted the repeater and sub rows and then readded them under a different name, here is my code:
<?php if( have_rows('social') ): ?> <?php while( have_rows('social') ): the_row(); ?> <a href="<?php the_sub_field( "media_image" ); ?>" target="_blank"><img src="<?php the_sub_field( "media_link" ); ?>" /></a> <?php endwhile; ?> <?php endif; ?>
I don’t see anything wrong there?
If you are loading a value from the options page, you MUST target it by using the second parameter
You can learn more about this here:
In your OP you said that this is for an options page. If this is the case then I missed something in your code that is pretty important. You need to use the value of
'option' for the post id.
<?php if( have_rows('social', 'option') ): ?> <?php while( have_rows('social', 'option') ): // the rest of your code here
For more information on getting values from options pages see this page http://www.advancedcustomfields.com/resources/get-values-from-an-options-page/ it includes an example on repeater sub fields.
When an image field is set, you will see 2 icons when hovering over it.
1. remove – this clears the value and allows a new image to be set. It does note DELETE the image, simply clears the value.
2. Edit – this allows you to edit the image data.
These icons allow an image to be changed, so I don’t see any issue here.
You must be logged in to reply to this topic.
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!
© 2022 Advanced Custom Fields.