반응형
WP 플러그인 업그레이드 후 Google Maps API V3 오류 발생
WP Advanced Custom Fields를 업그레이드한 후 Google 지도에 문제가 있습니다. 지도는 올바르게 표시되지만 페이지가 끝없이 로드됩니다. FF의 JS 오류 콘솔에 오류가 표시됩니다.
Error: a is undefined
Source File: https://maps.gstatic.com/intl/en_us/mapfiles/api-3/10/19/main.js
Line: 70
Error: q.queue[Za]() is not a function
Source File: https://maps.gstatic.com/intl/en_us/mapfiles/api-3/10/19/main.js
Line: 74
맵 JS를 생성하는 나의 코드는:
<script type="text/javascript" src="https://maps.google.com/maps/api/js? key=AIzaSyCwynu3lxKxNPk5DNMWCx8oyGX8ka8_KqU&sensor=false"></script>
<script type="text/javascript">
//<![CDATA[
var is_init = false;
var map;
function map_init() {
var latlng = new google.maps.LatLng(<?php echo $lat; ?>, <?php echo $lng; ? >);
var myOptions = {
zoom: <?php echo $zoom; ?>,
center: latlng,
scrollwheel: false,
panControl: false,
zoomControl: true,
mapTypeControl: false,
scaleControl: true,
streetViewControl: true,
overviewMapControl: false,
mapTypeId: google.maps.MapTypeId.<?php echo $maptype; ?>
};
map = new google.maps.Map(document.getElementById("map_canvas"), myOp tions);
var marker;
var latlng;
<?php $i = 0; foreach($markers as $title=>$marker): ?>
<?php if(!empty($marker['lat']) && !empty($marker['lng'])) { ?>
latlng = new google.maps.LatLng(<?php echo $marker['lat']; ?>,<?php echo $marker['lng']; ?>);
marker<?php echo $i; ?> = new google.maps.Marker({
position: latlng,
map: map,
icon: '/wp-content/themes/iw/marker/<?php echo $marker['typ']; ? >.png',
title: '<?php echo $title; ?>'
});
google.maps.event.addListener(marker<?php echo $i; ?>, 'click', function() {
window.location.href = '<?php echo $marker['link']; ?>';
});
google.maps.event.addListener(marker<?php echo $i; ?>, 'mouseover', function() {
jQuery('.sbmlink<?php echo $i; ?>').addClass('mouseover');
});
google.maps.event.addListener(marker<?php echo $i; ?>, 'mouseout', func tion() {
jQuery('.sbmlink<?php echo $i; ?>').removeClass('mouseover');
});
<?php } ?>
<?php $i++; endforeach; ?>
is_init = true;
}
jQuery(function(){
jQuery('#map_button').click(function(){
jQuery('#map_canvas').toggle();
if (!is_init) {
map_init();
}
if(jQuery('#map_button').html() == 'Hier klicken, um die Karte einzublenden') {
jQuery('#map_button').html('Hier klicken, um die Karte auszublenden');
document.cookie="mapstate=open; path=/;";
} else {
jQuery('#map_button').html('Hier klicken, um die Karte einzublenden');
document.cookie="mapstate=closed; path=/;";
}
});
<?php if ($mapstate == 'open' || ($map_default_open && !isset($_COOKIE['mapstate']))): ?>
jQuery('#map_button').click();
<?php endif; ?>
jQuery.ajax({
dataType : 'json',
// url : '/wetter.php?ort=<?php echo $custom['wetterort'][0]; ?>',
success : function(data) {
jQuery('.wetterzustand').html(data.wetterzustand);
jQuery('.wettertemperatur').html(data.wettertemperatur + ' °C');
jQuery('.wettericon').html('<img alt="' + data.wetterzustand + '" src="' + data.wettericon + '"/>');
}
});
});
//]]>
</script>
word press를 업데이트하면 jquery-ui가 업데이트되지 않아 함수에 수동으로 코드를 삽입해야 하기 때문에 이러한 오류가 발생했습니다.jquery-ui 업데이트를 위한 우리 테마의 php.저 역시 같은 문제에 직면해 있었습니다.도움이 됐어요.
function new_google_map_script($post) {
wp_enqueue_style('admin-main', get_bloginfo('template_url') . '/css/admin-main.css');
//wp_enqueue_style('jquery-ui', get_bloginfo('template_url') . '/css/jquery-ui.css');
wp_enqueue_style('wp-jquery-ui');
wp_enqueue_style('wp-jquery-ui-dialog');
}
add_action('wp_enqueue_scripts', 'new_google_map_script');
언급URL : https://stackoverflow.com/questions/13936860/google-maps-api-v3-errors-after-upgrading-a-wp-plugin
반응형
'programing' 카테고리의 다른 글
리소스 ID에서 리소스 이름을 가져오는 방법 (0) | 2023.09.19 |
---|---|
Oracle에서 인덱스가 클러스터된 것입니까 아니면 클러스터되지 않은 것입니까? (0) | 2023.09.19 |
phpMyAdmin에 정의된 "내부 관계"란 무엇입니까? (0) | 2023.09.19 |
constant *p vs. int constant *p - 유형 다음에 const를 허용합니까? (0) | 2023.09.19 |
zip 파일 다운로드 방법 (0) | 2023.09.19 |