Add travelers to select
This commit is contained in:
parent
1d71f088ad
commit
3875e086cb
1 changed files with 7 additions and 0 deletions
|
|
@ -68,9 +68,11 @@
|
||||||
<?php
|
<?php
|
||||||
query_posts( 'category_name=urlaub&posts_per_page=10000' );
|
query_posts( 'category_name=urlaub&posts_per_page=10000' );
|
||||||
$locations = array();
|
$locations = array();
|
||||||
|
$traveler = array();
|
||||||
while ( have_posts() ) : the_post();
|
while ( have_posts() ) : the_post();
|
||||||
$places = get_field('orte');
|
$places = get_field('orte');
|
||||||
if($places){
|
if($places){
|
||||||
|
$traveler = array_unique(array_merge($traveler, get_field('mitreisende')));
|
||||||
foreach ($places as $place){
|
foreach ($places as $place){
|
||||||
$locations[] = array_merge(array("post" => $post->ID, "title" => $post->post_title, "traveler" => get_field('mitreisende')), $place);
|
$locations[] = array_merge(array("post" => $post->ID, "title" => $post->post_title, "traveler" => get_field('mitreisende')), $place);
|
||||||
}
|
}
|
||||||
|
|
@ -83,6 +85,11 @@
|
||||||
var places = <?php echo json_encode($locations); ?>;
|
var places = <?php echo json_encode($locations); ?>;
|
||||||
var map;
|
var map;
|
||||||
var map_center = {lat: parseFloat(places[0]['lat']), lng: parseFloat(places[0]['lng']) };
|
var map_center = {lat: parseFloat(places[0]['lat']), lng: parseFloat(places[0]['lng']) };
|
||||||
|
var traveler = <?php echo json_encode($traveler); ?>;
|
||||||
|
for(var i=0; i<traveler.length; i++){
|
||||||
|
var option = $('<option>'+traveler[i]+'</option>');
|
||||||
|
$('#travelers-select').append(option);
|
||||||
|
}
|
||||||
var markers = [];
|
var markers = [];
|
||||||
function initMap() {
|
function initMap() {
|
||||||
markers = [];
|
markers = [];
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue