I'm creating a custom Google map that plots multiple markers.
View the link as it will make it easier to explain what is happening and what I want
If you click on each marker it shows company names that are grabbed from the child pages. At the moment it's showing ALL the company names on each marker. How can I show just one company name per marker?
Here's the code controlling the little popup:
<?php $pages = get_pages(array('child_of' => 1873, 'sort_column' => 'menu_order'));
$counter = 1;
foreach($pages as $post)
{
setup_postdata($post);
$fields = get_fields(); ?>
<p><?php $counter++; echo $fields->company_name;?></p>
<?php } wp_reset_query(); ?>
Once it's looped through once, the next time it loops through I need it to start on the next child and not show the first one.