Support

Account

Home Forums Add-ons Repeater Field Repeater Field, Post Object and Google Map

Solved

Repeater Field, Post Object and Google Map

  • Hello guys !

    I just add the repeater field to my wordpress website, and it’s really awesome ! But i’m having a issue with a google map that I want to display.

    I’ve got a repeater field with inside a post object that refer to a place with a google map inside… and i don’t know how to show the map with all the places in ?

    At his time i’ve this code :

    <?php if( have_rows('evenement') ): while ( have_rows('evenement') ) : the_row(); ?>
    	<?php $post_object = get_sub_field('lieu_evenement');if( $post_object ): ?>
    		<?php $post = $post_object; setup_postdata( $post ); ?>
    			<?php $location = get_field('geolocalisation'); if( !empty($location) ):?>        
                <?php echo $location['lat']; ?>
                <?php echo $location['lng']; ?>
    			<?php endif; ?>
    		<?php wp_reset_postdata();  ?>
    	<?php endif; ?>
    <?php endwhile; ?>
    <?php else: ?>
    <?php endif; ?>

    It display the lat and the lng but i don’t know how to integrate the acf-map to display all the places in a single map !

    Anyone can help me ?

    Thanks

    Ben

  • I found the solution, i post it here if it can help someone :

    <?php if( have_rows('evenement') ): ?>
    	<div class="map">
    	<div class="acf-map">
        	<?php while ( have_rows('evenement') ) : the_row(); ?>
    			<?php $post_object = get_sub_field('lieu_evenement');if( $post_object ): ?>
    				<?php $post = $post_object; setup_postdata( $post ); ?>
    					<?php $location = get_field('geolocalisation'); if( !empty($location) ):?>        
    						<div class="marker" data-lat="<?php echo $location['lat']; ?>" data-lng="<?php echo $location['lng']; ?>">
                        		<div class="lieu"><?php the_title(); ?></div>
                        	</div>
    					<?php endif; ?>
    				<?php wp_reset_postdata();  ?>
    			<?php endif; ?>
    		<?php endwhile; ?>
    	</div>
        </div>
    <?php else: ?>
    <?php endif; ?>
Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Repeater Field, Post Object and Google Map’ is closed to new replies.