I am trying to place 2GIS map into wordpress shortcode. I cannot use HTML widget because I need PHP, I will use PHP to pull latitude and longitude from wordpress post fields. This will be in a single post page. I echo the HTML code because it should be inside function for wordpress shortcode. But then I get error on line 55.
Parse error: syntax error, unexpected 'map' (T_STRING), expecting ';' or ',' on line 55
Please help me understand this.
<?php
function test_func(){
echo '
<html>
<head>
<title>API карт 2ГИС</title>
<script src="https://maps.api.2gis.ru/2.0/loader.js?pkg=full"></script>
<script type="text/javascript">
var map;
DG.then(function () {
map = DG.map('map', { // line 55
center: [54.98, 82.89],
zoom: 13
});
DG.marker([54.98, 82.89]).addTo(map);
});
</script>
</head>
<body>
<div id="map" style="width:800px; height:400px"></div>
</body>
</html>
';
}
add_shortcode('test_shortcode', 'test_func');
?>