javascript - Cannot read property 'lat' of null in wordpress -
i using wordpress theme atlas listing. in theme page has map. things in theme working properly, listing icons on map not coming. when inspect element in chrome error appears: uncaught typeerror: cannot read property 'lat' of null in maps.gstatic.com/intl/en_all/mapfiles/api-3/17/5/main.js:27 , map
map: { <?php if(get_field('disable_map_autofit','option')) { ?> latlng: [<?php the_field('custom_map_center','option');?>], //latlng = <?php echo 'new google.maps.latlng(38.4413426,27.0769706)'; $zoomlevel = '11'; ?>, //latlng: [38.41885,27.12871999999993], <?php } ?> options: { "zoom": <?php echo '15'; /*if(get_field('adjust_zoom','option') !== '') { echo get_field('adjust_zoom','option'); } else { echo '18'; } */?>, "draggable": <?php if(get_field('is_draggable','option')) { echo "true"; } else { echo 'false'; } ?>, "maptypecontrol":<?php if(get_field('map_type_control','option')) { echo "true"; } else { echo 'false'; } ?>, "maptypeid": google.maps.maptypeid.<?php echo the_field('map_type_id','option');?>, "scrollwheel": <?php if(get_field('scrollwheel_control','option')) { echo "true"; } else { echo 'false'; } ?>, "pancontrol": true, "rotatecontrol": false, "scalecontrol": true, "streetviewcontrol": <?php if(get_field('street_view_control','option')) { echo "true"; } else { echo 'false'; } ?>, "zoomcontrol": <?php if(get_field('zoom_control','option')) { echo "true"; } else { echo 'false'; } ?>, "keyboardshortcuts": <?php if(get_field('keyboard_shortcuts','option')) { echo "true"; } else { echo 'false'; } ?>, "zoomcontroloptions": { <?php if(get_field('add_rtl_support','option')) { ?> style: google.maps.zoomcontrolstyle.default <?php } else { ?> style: google.maps.zoomcontrolstyle.small <?php } ?> } } },marker: { values: [ <?php $args = array( 'post_type' => 'listing', 'posts_per_page' => 900); $listing_marker_loop = new wp_query( $args ); while ( $listing_marker_loop->have_posts() ) : $listing_marker_loop->the_post(); $address = get_field('location'); global $post; // load 'categories' terms post $terms = get_the_terms($post->id, 'listings_categories'); // utilize first term load acf info if( !empty($terms) ) { $term = array_pop($terms); // checking if listing featured, if load marker image. if(get_field("listing_is_featured")) { $custom_marker = get_field('featured_marker', 'listings_categories_' . $term->term_id ); } else { $custom_marker = get_field('marker_type', 'listings_categories_' . $term->term_id ); } } if(!empty($address['coordinates'])) { ?> { latlng: [<?php echo $address['coordinates'];?> <?php if(get_field('multiple_marker_address','option')) { echo "+ (math.random() -.5) / 1500"; } ?>], options: { <?php if($custom_marker !=='') { ?> icon: "<?php echo $custom_marker; ?>", <?php } else { ?> icon: "", <?php } ?> shadow: "" }, data: '<div class="marker-wrapper <?php if(get_field("listing_is_featured")) { echo "featured-listing";} ?> animated fadeindown"><div class="marker-title"> <a href="<?php the_permalink();?>"><?php $term_list = wp_get_post_terms($post->id, 'listings_categories', array("fields" => "names")); echo "gözlem konusu : " .implode(",",$term_list);//the_title(); ?></a> </div><div class="marker-content"> <?php get_template_part( "includes/popup", "content" );?> <?php get_template_part( "includes/popup", "image" );?> <div class="clearboth"></div> <div class="close"><span class="icon-cancel"></span></div></div><span class="icon-down-dir"></span></div>' }<?php if ($listing_marker_loop->current_post +1 == $listing_marker_loop->post_count) { ?><?php } else {echo',';} ?> <?php } ?> <?php endwhile; ?> ], cluster:{ radius: 20, // style used clusters more 0 markers 0: { content: "<div class='cluster cluster-1 dp-button medium'>cluster_count</div>", width: 90, height: 80 }, // style used clusters more 20 markers 20: { content: "<div class='cluster cluster-2 dp-button medium'>cluster_count</div>", width: 90, height: 80 }, // style used clusters more 50 markers 50: { content: "<div class='cluster cluster-3 dp-button medium'>cluster_count</div>", width: 90, height: 80 }, events: { click: function(cluster) { map.panto(cluster.main.getposition()); map.setzoom(map.getzoom() + 2); } } }, events: { click: function(marker, event, context){ map.panto(marker.getposition()); infobox.setcontent(context.data); infobox.open(map,marker); } } }, by code latlng coming. icons on latlng not coming please help me out.thanks in advance.
javascript php
No comments:
Post a Comment