Closed garageeks closed 1 year ago
check out window.WPLeafletMapPlugin.geojsons
: that should be an array of L.GeoJSON layers which you should be able to use to run onEachFeature.
also template
is the only function I've written a unit test for! https://github.com/bozdoz/wp-plugin-leaflet-map/blob/master/tests/App.test.js
It basically uses properties from your GeoJSON to create a string:
Property: {name}
would create a different popup for each layer that has a name
property for example.
If this works for you, I will close this ticket
Hi to all, I'm trying to style the popups, which are populated by a GeoJSON features collection. While working directly with LeafletJS, in the OnEachFeature function, I can compose the popup content with html, therefore I assign CSS classes to the title, headings etc. How can I add CSS in the popup content here? I see the relevant OnEachFeature function is in class.geojson-shortcode.php, I could hack it, but perhaps there is a supported way to do this. For instance, I don't know what this does:
window.WPLeafletMapPlugin.template( popup_text, feature.properties );
Thank you for your help Nick