Home Forums Add-ons Repeater Field Identifying row by shortcode attribute


Identifying row by shortcode attribute

  • I’m trying to create a shortcode that would have attributes that the user could define (ID, alignment, etc). I’m trying to get the shortcode attribute to call out the row that it associates to, rather than loop through each row.

    For example: I have 5 different repeater rows (each with a text box and a text area), in my content of a post, I insert my shortcode ‘[figure id=2 align=right]’

    This shortcode should then grab the title and content of row #2 in my repeater field…I hope this is making sense.


  • if you do get_field($repeater); this should return an array containing a nested array for each row.

    // assumes $row = the row you want to get
    $rows = get_field($repeater);
    $values = $rows[$row - 1];
    echo $values[$text_field];
    echo $values[$texteares_field];
  • That worked. Thanks!

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

The topic ‘Identifying row by shortcode attribute’ is closed to new replies.