Home » Topics » Priority Support » ACF Repeater field in widgets?

ACF Repeater field in widgets?

ACF Widgets Support Priority Support ACF Repeater field in widgets?

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #1881
    kmeronuk
    Participant

    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?

    #1883
    Daron Spence
    Keymaster

    Hi Kevin,

    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 🙂

    #1884
    kmeronuk
    Participant

    Hi Daron,
    Running WP 4.1.1 ACF Pro 5.1.9.1 and ACFW 1.3.1

    I have two widgets set up:
    Widget: Subscribe
    wdgt_subscribe_heading
    wdgt_subscribe_copy
    wdgt_subscribe_formid

    This one is working fine.

    Widget: Socialize
    wdgt_socialize_heading
    wdgt_socialize_links (this is the repeater)
    wdgt_socialize_url
    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>

    Thanks

    #1885
    Daron Spence
    Keymaster

    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.

    #1886
    kmeronuk
    Participant

    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.

    #1887
    kmeronuk
    Participant

    Hi Daron,

    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.

    #1888
    Daron Spence
    Keymaster

    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!

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘ACF Repeater field in widgets?’ is closed to new replies.