Support

Account

Home Forums Add-ons Repeater Field Repeater field shortcode? Reply To: Repeater field shortcode?

  • I updated the code to run as I mentioned above. You can find it here:

    https://gist.github.com/FranciscoG/c393d9bc6e0a89cd79d1fd531eccf627

    I also forgot to mention that it will parse shortcodes within the repeater rows

    
    [acf_repeater field="my-row" sub_fields="full-name,phone-num"]
    name: %full-name%
    [another_shortcode]phone: %phone-num%[/another_shortcode]
    [/acf_repeater]
    

    Caveat: You can not do nested repeater rows. However you need to you can just duplicate the add_shortcode and add more shortcode repeaters shortcodes and it will work. There’s probably a much better way to handle unrestricted amount of sub-repeaters but that’s a lot more work and testing for another day

    
    add_shortcode("acf_repeater", "my_acf_repeater");
    add_shortcode("acf_sub_repeater", "my_acf_repeater");