One of the best features of the WordPress plugin “Advanced Custom Field (ACF)” is the ability not just to add custom fields, but by extension the abilty to create field type called ‘repeat’.
This lets editors add rows of content that is associated with a field (in a crude way it’s like having relational data).
So, having created the field and poplated it with data (for example, adding multiple images to a post to are presented in a table)
// test if the ACF field has rows
if( have_rows(‘image_sliders’) ):
// run through the rows to get elements in each row
while ( have_rows(‘image_sliders’) ) : the_row();
// get_sub_field is the key
echo “<div class=’imagecon’><a href=”.$theLink.”><img src=”.$theImg.”></a></div>”;
// clear query after use