我通过以下几点做到了这一点website
检查“Ubicación”块。我是用ACF Pro(5.0)完成的。我正在与您共享实现此功能所需的代码。希望这是您正在寻找的内容(有一些不需要的额外字段)。
<?php
$image = get_field(\'location_background_image\', \'option\');
$size = \'background\';
$location_background_image_url = $image[\'sizes\'][ $size ];
?>
<section id="location" class="location-section" style="<?php if( get_field(\'location_background_color\',\'option\') ): ?>background-color:<?php the_field(\'location_background_color\',\'options\'); ?>;<?php endif; ?><?php if( get_field(\'location_background_image\',\'option\') ): ?>background-image:url(<?php echo $location_background_image_url; ?>); background-size:cover;<?php endif; ?>">
<div class="container scrollpoint sp-effect3">
<?php if( get_field(\'location_title\',\'option\') ): ?><h1 class="text-center"><?php the_field(\'location_title\',\'options\'); ?></h1><?php endif; ?>
<?php if( get_field(\'location_description\',\'option\') ): ?>
<div id="location-description" class="text-center"><?php the_field(\'location_description\',\'options\'); ?></div>
<?php endif; ?>
<style type="text/css">
.acf-map {
width: 100%;
height: 400px;
border: #ccc solid 1px;
margin: 40px 0;
}
</style>
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<?php if( have_rows(\'locations\',\'options\') ): ?>
<div class="acf-map">
<?php while ( have_rows(\'locations\',\'options\') ) : the_row();
$location = get_sub_field(\'location\');
?>
<div class="marker" data-lat="<?php echo $location[\'lat\']; ?>" data-lng="<?php echo $location[\'lng\']; ?>">
<h4><?php the_sub_field(\'title\'); ?></h4>
<p><?php the_sub_field(\'description\'); ?></p>
</div>
<?php endwhile; ?>
</div>
<?php endif; ?>
</div> <!-- .container -->
</section> <!-- section#location -->
<div class="section-divider blue">
<a class="scroll" href="#responsability"><i class="fa fa-angle-down fa-3x"></i></a>
</div> <!-- .section-divider blue -->