February 27, 2015 at 1:51 PM #1881
Just wondering if it’s possible to use a Repeater field with ACF Widgets? I’ve tried setting one up, but so far I can’t get it to work properly.
I have a widget that includes:
– text field
– repeater field
– URL field
– text field
When I add content to the widget, the text field in the repeater won’t save. Every time I save the widget, the text field content within the repeater field disappears. All of the other fields are saving their data properly.
Any ideas?February 27, 2015 at 2:03 PM #1883
What versions of WordPress, ACF and ACFW are you using? I just tested this on my multisite install and it seems to work as expected. Maybe you have a naming conflict? Try adjusting those from within ACF and report back 🙂February 27, 2015 at 2:17 PM #1884
Running WP 4.1.1 ACF Pro 18.104.22.168 and ACFW 1.3.1
I have two widgets set up:
This one is working fine.
wdgt_socialize_links (this is the repeater)
wdgt_socialize_name (this is the value that isn’t saving)
I don’t have any other fields set up with those names.
I’m developing the site locally, so running on a WAMP setup, but I haven’t noticed any other issues, and unfortunately it’s not accessible online at the moment, but if need be I could set up a staging area for you to take a look at it.
Here’s the code for my widget:
<h4><?php the_field('wdgt_socialize_heading', $acfw); ?></h4> <ul> <?php if( have_rows('wdgt_socialize_links', $acfw) ): while ( have_rows('wdgt_socialize_links', $acfw) ) : the_row(); $url = get_sub_field('wdgt_socialize_url', $acfw); $site = get_sub_field('wdgt_socialize_name', $acfw); ?> <li><a href="<?php echo $url; ?>" target="_blank"><?php echo $site; ?></a></li> <?php endwhile; else : // no rows found endif; ?> </ul>
ThanksFebruary 27, 2015 at 2:39 PM #1885
Hmm…I setup a widget with a similar setup to yours, and all of my values are saving correctly. I haven’t tried to the output yet, but I’m assuming that part isn’t what you are having trouble with?
No need to setup a staging site. We can use google hangouts to do some troubleshooting if we haven’t figured it out by the time I get off work. (5Pm central).
My suggestion would be to create a new field group with the same setup (duplicate the old one if you want) and change the names to something very generic so you can tell them apart. It looks like everything should be working though.February 27, 2015 at 3:06 PM #1886
I’ve added content to the heading field and have created two rows in the repeater. When I view it on the frontend, the heading displays and there are two list items generated. When I inspect them, I see that they’re adding the href and the link values for each item, but the Name field is blank.
Going into the Appearance -> Widgets it’s showing that the Name fields for each row are blank.
I’ve just got to head out for an hour or two here, but will try duplicating things when I’m back.February 27, 2015 at 7:08 PM #1887
So, I created a new widget, duplicated the field group and changed the field names, duplicated the widget template and changed the field names then tried out the new widget and… it worked.
Must have been gremlins.
Thanks for your help.February 28, 2015 at 12:40 PM #1888
Glad you got it figured out Kevin! It happens to all of us. 🙂 Marking this as closed. If you need any more help with this, a new comment will reopen the thread.
Cheers! Thanks for supporting the plugin!
- The topic ‘ACF Repeater field in widgets?’ is closed to new replies.