create a shortcode for embedding google map in a page

function bartag_func( $atts ) { $atts = shortcode_atts( array( ‘latitude’ => ‘28.66’, // default value ‘longitude’ => ‘99.25’ // default value ), $atts, ‘bartag’ ); return <div class=”” latitude=” ‘.$atts[‘latitude’].’ ” longitude=” ‘.$atts[‘longitude’].’ “></div>’; } add_shortcode( ‘bartag’, ‘bartag_func’ ); Now you can use shortcode like : [bartag latitude=”12.34″ latitude=”12.34″] will return : <div class=”” latitude=”12.34″ … Read more

Post title and url not showing on google map marker [closed]

I have solved it by doing it like this. function myMap() { var gmarkers = []; var markers = []; var infowindow = new google.maps.InfoWindow({ content: ” }); var myCenter = new google.maps.LatLng(44.794426, 20.451849); var mapProp = {center:myCenter, zoom:15, scrollwheel:false, draggable:true, mapTypeId:google.maps.MapTypeId.ROADMAP}; var map = new google.maps.Map(document.getElementById(“googleMap”),mapProp); var myJsarray = passed_object.retrieve_data; var latitute=”” ; var … Read more

Filtering markers on google map by WordPress category[SOLVED]

Solved, the problem was in filterMarkers() function filterMarkers = function (category) { var markers = gmarkers[i]; for (var i = 0; i < gmarkers.length; i++) { // If is same category or category not picked if (gmarkers[i].category == category || category.length === 0) { gmarkers[i].setVisible(true); } // Categories don’t match else { gmarkers[i].setVisible(false); } } … Read more

Insert Google Maps HTML in WordPress

I’m not sure, which wordpress version you are using but all wordpress versions supports custom html embedding on page. Here’s how you can do: (WordPress 5.1.1) Go to Pages Add/Edit Page Click on Plus Icon (step 1 in below screenshot) Search for Custom HTML (step 2 in below screenshot) 5. Paste map html in page … Read more