Support

Account

Home Forums Backend Issues (wp-admin) Can't update options page repeater image

Solved

Can't update options page repeater image

  • 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

  • When you hover over the image 2 icons should appear, one will allow you to edit the image and the other should allow you to remove the image. Do yo not get these iccos>

  • Hi John,
    Thanks for the fast response, I saw that and upon clicking on the edit icon (pencil) there is no option to change the image in the popup that appears, is there anyway I can allow the option for the images to be updateable via the admin cp?

    thanks
    Graham

  • When you say edit, do you mean change the image? To do that you need to delete the image ans select another. If you mean alter the image, there is another edit link in the popup that will let you alter the image with the built in WP controls.

  • Hi John,
    Yeah I mean change the image for a completely different image, will this be a feature in future releases as I see that being more important than manipulating a image.

    Regards
    Graham

  • 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.

  • Hi John,
    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?

    Graham

  • Are you running some type of caching plugin? Other than that maybe something in the code that’s displaying the image. If you can provide the code I might be able to help.

  • Hi John,
    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.

  • Hi John,
    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?

  • Hi @gab1982

    If you are loading a value from the options page, you MUST target it by using the second parameter $post_id.

    You can learn more about this here:
    http://www.advancedcustomfields.com/resources/get-values-from-an-options-page/

  • 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.

  • Thanks John and Elliot,
    That fixed it, I can’t believe I forgot about that after reading through all the documentation.

    Elliot: Do you think in the future people will be able to change the image when a image field is set?

    Graham

  • Hi guys.

    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.

Viewing 18 posts - 1 through 18 (of 18 total)

The topic ‘Can't update options page repeater image’ is closed to new replies.