I have to make a shortcode with acf repeater fields. I have to put the name, function of the person and a picture. The shortcode works for the name and function of the person. But I can't get the image to work here is my code:
function elus_crew($atts){
ob_start();
$team = get_field('les_elus', 'option');
if ($team){
foreach ($team as $crew):
$image_team = $row['photo_de_lelu'];
echo wp_get_attachment_image($image_team);
echo '<h2>' . $crew ['prenom_nom_elu'] . '</h2>';
echo '<span>' . $crew ['fonction_elu'] . '</span>';
endforeach;
$short_list = ob_get_clean();;
return $short_list;
}
}
add_shortcode('team_vigneaux', 'elus_crew');