Может кому пригодится.
function the_multiple_yandex_map($posts = array()){
global $post;
$marks = array(); // Все метки
$marks_counter = 1;
foreach ($posts as $post) {
$data = (array)json_decode(get_field('местоположение', get_the_ID(), false), true); // загрузка меток из записи
if (!isset($data['marks']) || !is_array($data['marks'])) {
continue;
}
$images = get_field('фото');
$image = array_shift($images);
$top_term = get_top_term( 'district' );
foreach ((array)$data['marks'] as $mark) {
$mark['id'] = $marks_counter;
$mark['content'] = "<div class='mark_building'>";
//$mark['content'] .= "<img src='".$image['url']."' alt='".$image['alt']."' />";
$mark['content'] .= "<div class='mark_info'>";
$mark['content'] .= "<div class='info_title'><a href='".get_the_permalink()."'>".get_the_title()."</a></div>";
$mark['content'] .= "<ul>";
$mark['content'] .= "<li><span>Адрес</span><span>".get_field('адрес')."</span></li>";
$mark['content'] .= "<li><span>Район</span><span>".$top_term->name."</span></li>";
$mark['content'] .= "<li><span>Цена за м2</span><span>".get_field('цена_от')."</span></li>";
$mark['content'] .= "</ul>";
$mark['content'] .= "</div>";
$mark['content'] .= "</div>";
$marks[] = $mark;
$marks_counter++;
}
}
$map_data = array(
"center_lat" => 45.035566,
"center_lng" => 38.974711,
"zoom" => 12,
"type" => "map"
); // загрузка параметров карты для вывода всех меток
$map_data['marks'] = $marks;
echo '<div>'.the_yandex_map('', false, json_encode($map_data), 450).'</div>';
//echo '<pre>'.var_dump(json_encode($map_data)).'</pre>';
}