Support

Account

Home Forums Add-ons Repeater Field Shortcode for Repeater Field?

Solving

Shortcode for Repeater Field?

  • Hi,
    Is there a shortcode for repeater-field?

    Regards, Sebastian

  • Shortcodes in acf are only meant for “Basic” field types.

    It is possible to show the value of a basic field type in a repeater if you use the correct field name. Here is how repeater fields are stored

    
    "{$repeater}_{$index}_{$sub_field}"
    
    // $repeater = name of the repeater field
    // $index = the row, starting at 0
    // $sub_field = name of the sub field
    
  • Hey John, thanks for the support.

    Could such a solution work?

    function acf_shortcode() {
        ob_start();
        ?> 
         custom field php here
        <?php
        return ob_get_clean();
    }
    add_shortcode( 'shortcode_tag','acf_shortcode' );
  • Custom shortcodes are always a possible solution. Yes, you could create your own shortcode and supply parameters to output rows of a repeater.

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

The topic ‘Shortcode for Repeater Field?’ is closed to new replies.