Support

Account

Home Forums Front-end Issues A google map with all registereds persons Reply To: A google map with all registereds persons

  • Hi,
    i found the soluce :

    
    $the_query_map = new WP_Query( array( 'post_type' => 'vignerons', 'posts_per_page' => -1, 'order' => 'ASC', 'orderby' => 'menu_order' ) );
    
    if($the_query_map->have_posts()) :
    while($the_query_map->have_posts()):
    $the_query_map->the_post();
    $the_ID = get_the_ID();
    $link_vignerons = get_the_permalink();
    $get_google_map = get_field('carte', $value);
    $title_vignerons = get_the_title();
    
    $output_map[$the_ID]['map'] = '<div class="marker" data-lat="'.$get_google_map['lat'].'" data-lng="'.$get_google_map['lng'].'" 
    <h4><a href="'.$link_vignerons.'" rel="bookmark"> '.$title_vignerons.'</a></h4></div>';
    endwhile; endif;
    wp_reset_postdata();
    
    ?><div class="acf-map"><?php
    foreach( $output_map as $key => $map_marker ):
    	echo $map_marker['map'];
    	endforeach;
    	?>
    </div>
    

    Hope this help someone!