WordPress.org

Ready to get started?Download WordPress

Forums

Leaflet Maps Marker (Google Maps, OpenStreetMap, Bing Maps)
Pulling in from wordpress installed within separate folder. (7 posts)

  1. missstyles
    Member
    Posted 1 year ago #

    I have wordpress installed in a folder externally as an RSS feed, I've managed to pull the map in using the do shortcode link - and all the markers are showing up fine however the map never loads, I have looked at the source code for sites which I have previously installed this plug in on and I have included the files in the header for the;

    css file: news/wp-content/plugins/leaflet-maps-marker/leaflet-dist/leaflet.css

    js file: news/wp-content/plugins/leaflet-maps-marker/leaflet-dist/leaflet.js

    I've also added this:
    <script type='text/javascript' src='https://www.google.com/jsapi?key='></script>
    <script type='text/javascript'>
    /* <![CDATA[ */
    var leafletmapsmarker_L10n = {"lmm_zoom_in":"Zoom in","lmm_zoom_out":"Zoom out","lmm_googlemaps_language":"","lmm_googlemaps_libraries":"","lmm_googlemaps_base_domain":"&base_domain=maps.google.com","lmm_bing_culture":""};
    /* ]]> */

    and the IE fallback:
    <!--[if lt IE 9]>
    <link rel='stylesheet' id='leafletmapsmarker-ie-only-css' href='http://domain.co.uk/news/wp-content/plugins/leaflet-maps-marker/leaflet-dist/leaflet.ie.css' type='text/css' media='all' />
    <![endif]-->

    But the plug in is still not loading, is there something I am missing?

    Thanks in advance!

    http://wordpress.org/extend/plugins/leaflet-maps-marker/

  2. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,
    I would need a link so that i can have a look. If this alone isnt enough, temporary admin access would be great
    regards,
    Robert

  3. missstyles
    Member
    Posted 1 year ago #

    Thanks - Can I email the URL and log in details across to you?

  4. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    of course - see contact page on mapsmarker.com

  5. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    I took a look but I dont quite understand your setup. I dont see the contact page anywhere in WordPress - neither as post, page or template file.

    you included all static js + css files, which is fine. But you are completely missing the dynamic js output created for each map, which looks like this:

    /* Maps created with MapsMarker.com WordPress plugin - version 3.2.4 */
    jQuery(document).ready( function($) {
    				function resizeMap() {
    					var map = $('#lmm_1aff5709');
    					var map_list_markers_div = $('#lmm-listmarkers-1aff5709');
    					var map_list_markers_table = $('#lmm-listmarkers-table-1aff5709');
    					var map_parent_size = $('#lmm_1aff5709').parent().width();
    					if( map_parent_size < 640 ) {
    						map.css({ 'width': '100%'});
    						map_list_markers_div.css({ 'width': '100%'});
    						map_list_markers_table.css({ 'width': '100%'});
    						lmm_map_1aff5709.invalidateSize();
    					}
    				}
    				resizeMap();
    				$(window).resize(resizeMap);
    			});
    var layers = {};
    var markers = {};
    var lmm_map_1aff5709 = {};
    (function($) {
    lmm_map_1aff5709 = new L.Map("lmm_map_1aff5709", { dragging: true, touchZoom: true, scrollWheelZoom: true, doubleClickZoom: true, boxzoom: true, trackResize: true, worldCopyJump: true, closePopupOnClick: true, keyboard: true, keyboardPanOffset: 80, keyboardZoomOffset: 1, inertia: true, inertiaDeceleration: 3000, inertiaMaxSpeed: 1500, zoomControl: true, crs: L.CRS.EPSG3857 });
    lmm_map_1aff5709.attributionControl.setPrefix("<a href=\"http://mapsmarker.com/go\" target=\"_blank\" title=\"powered by 'Leaflet Maps Marker'-Plugin for WordPress\">MapsMarker.com</a> (<a href=\"http://www.leafletjs.com\" target=\"_blank\" title=\"'Leaflet Maps Marker' uses the JavaScript library 'Leaflet' for interactive maps by CloudMade\">Leaflet</a>, <a href=\"http://mapicons.nicolasmollet.com\" target=\"_blank\" title=\"'Leaflet Maps Marker' uses icons from the 'Maps Icons Collection'\">Icons</a>)");
    var osm_mapnik = new L.TileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png", {maxZoom: 18, minZoom: 1, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Map: &copy; 2012 <a href=\"http://www.openstreetmap.org\" target=\"_blank\">OpenStreetMap contributors</a>, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\" target=\"_blank\">CC-BY-SA</a>", detectRetina: true});
    var mapquest_osm = new L.TileLayer("http://{s}.mqcdn.com/tiles/1.0.0/osm/{z}/{x}/{y}.png", {maxZoom: 18, minZoom: 1, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Map: Tiles Courtesy of <a href=\"http://www.mapquest.com/\" target=\"_blank\">MapQuest</a> <img src=\"http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/logo-mapquest.png\" style=\"display:inline;\" /> (<a href=\"http://www.openstreetmap.org\" target=\"_blank\">OpenStreetMap</a>, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\" target=\"_blank\">CC-BY-SA</a>)", subdomains: ["otile1","otile2","otile3","otile4"], detectRetina: true});
    var mapquest_aerial = new L.TileLayer("http://{s}.mqcdn.com/naip/{z}/{x}/{y}.png", {maxZoom: 18, minZoom: 1, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Map: <a href=\"http://www.mapquest.com/\" target=\"_blank\">MapQuest</a> <img src=\"http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/logo-mapquest.png\" style=\"display:inline;\" />, Portions Courtesy NASA/JPL-Caltech and U.S. Depart. of Agriculture, Farm Service Agency", subdomains: ["oatile1","oatile2","oatile3","oatile4"], detectRetina: true});
    var googleLayer_roadmap = new L.Google("ROADMAP", {detectRetina: true});
    var googleLayer_satellite = new L.Google("SATELLITE", {detectRetina: true});
    var googleLayer_hybrid = new L.Google("HYBRID", {detectRetina: true});
    var googleLayer_terrain = new L.Google("TERRAIN", {detectRetina: true});
    var bingaerial = new L.BingLayer("Agj2Jczv837wHWeeM10JbkthyPBN2-0w4IvzNuXS9Wqrixod0hMXSzFt5mpzLTQR", {type: "Aerial", maxZoom: 21, minZoom: 1, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", detectRetina: true});
    var bingaerialwithlabels = new L.BingLayer("Agj2Jczv837wHWeeM10JbkthyPBN2-0w4IvzNuXS9Wqrixod0hMXSzFt5mpzLTQR", {type: "AerialWithLabels", maxZoom: 21, minZoom: 1, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", detectRetina: true});
    var bingroad = new L.BingLayer("Agj2Jczv837wHWeeM10JbkthyPBN2-0w4IvzNuXS9Wqrixod0hMXSzFt5mpzLTQR", {type: "Road", maxZoom: 21, minZoom: 1, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", detectRetina: true});
    var ogdwien_basemap = new L.TileLayer("http://{s}.wien.gv.at/wmts/fmzk/pastell/google3857/{z}/{y}/{x}.jpeg", {maxZoom: 19, minZoom: 11, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Map: City of Vienna (<a href=\"http://data.wien.gv.at\" target=\"_blank\" style=\"\">data.wien.gv.at</a>)", subdomains: ["maps","maps1", "maps2", "maps3"], detectRetina: true});
    var ogdwien_satellite = new L.TileLayer("http://{s}.wien.gv.at/wmts/lb/farbe/google3857/{z}/{y}/{x}.jpeg", {maxZoom: 19, minZoom: 11, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Map: City of Vienna (<a href=\"http://data.wien.gv.at\" target=\"_blank\">data.wien.gv.at</a>)", subdomains: ["maps","maps1", "maps2", "maps3"], detectRetina: true});
    var cloudmade = new L.TileLayer("http://{s}.tile.cloudmade.com//@2x/256/{z}/{x}/{y}.png", {maxZoom: 19, minZoom: 1, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Map: &copy; 2012 <a href=\"http://www.openstreetmap.org\" target=\"_blank\" style=\"\">OpenStreetMap contributors</a>, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\" target=\"_blank\">CC-BY-SA</a>, Imagery &copy; <a href=\"http://cloudmade.com\" target=\"_blank\">CloudMade</a>", subdomains: ["a","b","c"], detectRetina: true});
    var cloudmade2 = new L.TileLayer("http://{s}.tile.cloudmade.com//@2x/256/{z}/{x}/{y}.png", {maxZoom: 19, minZoom: 1, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Map: &copy; 2012 <a href=\"http://www.openstreetmap.org\" target=\"_blank\" style=\"\">OpenStreetMap contributors</a>, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\" target=\"_blank\">CC-BY-SA</a>, Imagery &copy; <a href=\"http://cloudmade.com\" target=\"_blank\">CloudMade</a>", subdomains: ["a","b","c"], detectRetina: true});
    var cloudmade3 = new L.TileLayer("http://{s}.tile.cloudmade.com//@2x/256/{z}/{x}/{y}.png", {maxZoom: 19, minZoom: 1, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Map: &copy; 2012 <a href=\"http://www.openstreetmap.org\" target=\"_blank\" style=\"\">OpenStreetMap contributors</a>, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\" target=\"_blank\">CC-BY-SA</a>, Imagery &copy; <a href=\"http://cloudmade.com\" target=\"_blank\">CloudMade</a>", subdomains: ["a","b","c"], detectRetina: true});
    var mapbox = new L.TileLayer("http://{s}.tiles.mapbox.com/v3/mapbox.blue-marble-topo-jul/{z}/{x}/{y}.png", {minZoom: 0, maxZoom: 8, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "MapBox/NASA, <a href=\"http://www.mapbox.com\" target=\"_blank\">http://www.mapbox.com</a>", subdomains: ["a","b","c","d"], detectRetina: true});
    var mapbox2 = new L.TileLayer("http://{s}.tiles.mapbox.com/v3/mapbox.geography-class/{z}/{x}/{y}.png", {minZoom: 0, maxZoom: 8, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "MapBox, <a href=\"http://www.mapbox.com\" target=\"_blank\">http://www.mapbox.com</a>", subdomains: ["a","b","c","d"], detectRetina: true});
    var mapbox3 = new L.TileLayer("http://{s}.tiles.mapbox.com/v3/mapbox.mapbox-streets/{z}/{x}/{y}.png", {minZoom: 0, maxZoom: 17, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "MapBox, <a href=\"http://www.mapbox.com\" target=\"_blank\">http://www.mapbox.com</a>", subdomains: ["a","b","c","d"], detectRetina: true});
    var custom_basemap = new L.TileLayer("http://avetics.com/bukitbrownimages/{z}/{x}/{y}.png", {maxZoom: 19, minZoom: 15, tms: true, attribution: "Map: © <a href=\"http://openstreetmap.org/\" target=\"_blank\">OpenStreetMap contributors</a>, <a href=\"http://creativecommons.org/licenses/by-sa/2.0/\" target=\"_blank\">CC-BY-SA</a>", continuousWorld: false, noWrap: false, detectRetina: true});
    var custom_basemap2 = new L.TileLayer("http://tile.stamen.com/watercolor/{z}/{x}/{y}.jpg", {maxZoom: 17, minZoom: 1, tms: false, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Map: Map tiles: <a href=\"http://stamen.com\" target=\"_blank\">Stamen Design</a>, <a href=\"http://creativecommons.org/licenses/by/3.0\" target=\"_blank\">CC BY 3.0</a>. Data: <a href=\"http://openstreetmap.org\" target=\"_blank\">OpenStreetMap</a>, <a href=\"http://creativecommons.org/licenses/by-sa/3.0\" target=\"_blank\">CC BY SA</a>", continuousWorld: false, noWrap: false, detectRetina: true});
    var custom_basemap3 = new L.TileLayer("http://{s}.tile2.opencyclemap.org/transport/{z}/{x}/{y}.png", {maxZoom: 18, minZoom: 1, tms: false, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Map: © Gravitystorm Ltd. <a href=\"http://www.thunderforest.com\" target=\"_blank\">Thunderforest</a>", subdomains: ["a", "b", "c"], continuousWorld: false, noWrap: false, detectRetina: true});
    var overlays_custom = new L.TileLayer("http://avetics.com/bukitbrownimages/{z}/{x}/{y}.png", {tms: true, attribution: "Addresses: City of Vienna (<a href=\"http://data.wien.gv.at\" target=\"_blank\">data.wien.gv.at</a>)", opacity: 1, maxZoom: 19, minZoom: 15, detectRetina: true});
    var overlays_custom2 = new L.TileLayer("http://{s}.wien.gv.at/wmts/beschriftung/normal/google3857/{z}/{y}/{x}.png", {tms: false, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Addresses: City of Vienna (<a href=\"http://data.wien.gv.at\" target=\"_blank\">data.wien.gv.at</a>)", opacity: 1, maxZoom: 17, minZoom: 1, subdomains: ["maps", "maps1", "maps2", "maps3"], detectRetina: true});
    var overlays_custom3 = new L.TileLayer("http://{s}.wien.gv.at/wmts/beschriftung/normal/google3857/{z}/{y}/{x}.png", {tms: false, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Addresses: City of Vienna (<a href=\"http://data.wien.gv.at\" target=\"_blank\">data.wien.gv.at</a>)", opacity: 1, maxZoom: 17, minZoom: 1, subdomains: ["maps", "maps1", "maps2", "maps3"], detectRetina: true});
    var overlays_custom4 = new L.TileLayer("http://{s}.wien.gv.at/wmts/beschriftung/normal/google3857/{z}/{y}/{x}.png", {tms: false, errorTileUrl: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/inc/img/error-tile-image.png", attribution: "Addresses: City of Vienna (<a href=\"http://data.wien.gv.at\" target=\"_blank\">data.wien.gv.at</a>)", opacity: 1, maxZoom: 17, minZoom: 1, detectRetina: true});
    var layersControl = new L.Control.Layers(
    {'OpenStreetMap': osm_mapnik,'Mapquest (OSM)': mapquest_osm,'Mapquest (Aerial)': mapquest_aerial,'Google Maps (Roadmap)': googleLayer_roadmap,'Google Maps (Satellite)': googleLayer_satellite,'Google Maps (Hybrid)': googleLayer_hybrid,'Google Maps (Terrain)': googleLayer_terrain,'Bing Maps (Aerial)': bingaerial,'Bing Maps (Aerial+Labels)': bingaerialwithlabels,'Bing Maps (Road)': bingroad,'Maptile test': custom_basemap,'Stamen Watercolor': custom_basemap2,'Transport Map': custom_basemap3},
    {'Maptile test': overlays_custom},
    { collapsed: true } );
    lmm_map_1aff5709.setView(new L.LatLng(48.216038, 16.378984), 11);
    lmm_map_1aff5709.addLayer(osm_mapnik).addControl(layersControl);L.control.scale({position:'bottomleft', maxWidth: 100, metric: true, imperial: true, updateWhenIdle: false}).addTo(lmm_map_1aff5709);
    var geojsonObj, mapIcon, marker_clickable, marker_title;
    geojsonObj = eval("(" + jQuery.ajax({url: "http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/leaflet-geojson.php?layer=all", async: false, cache: true}).responseText + ")");
    L.geoJson(geojsonObj, {
            onEachFeature: function(feature, marker) {
                if (feature.properties.text != '') {
                marker.bindPopup(feature.properties.text, {
                maxWidth: 300,
                minWidth: 250,
                maxHeight: 160,
                autoPan: true,
                closeButton: true,
                autoPanPadding: new L.Point(5, 5)
                });
                }
            },
    pointToLayer: function (feature, latlng) {
        mapIcon = L.icon({
            iconUrl: (feature.properties.icon != '') ? 'http://current.mapsmarker.com/wp-content/uploads/leaflet-maps-marker-icons/' + feature.properties.icon : 'http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/leaflet-dist/images/marker.png',
            iconSize: [32, 37],
            iconAnchor: [17, 36],
            popupAnchor: [-1, -32],
            shadowUrl: 'http://current.mapsmarker.com/wp-content/plugins/leaflet-maps-marker/leaflet-dist/images/marker-shadow.png',
            shadowSize: [41, 41],
            shadowAnchor: [16, 43],
            className: (feature.properties.icon == '') ? 'lmm_marker_icon_default' : 'lmm_marker_icon_'+ feature.properties.icon.slice(0,-4)
        });
    if (feature.properties.text == '') { marker_clickable = false } else { marker_clickable = true };
    if (feature.properties.markername == '') { marker_title = '' } else { marker_title = feature.properties.markername };
    return L.marker(latlng, {icon: mapIcon, clickable: marker_clickable, title: marker_title, opacity: 1});
    }
    }).addTo(lmm_map_1aff5709);
    })(jQuery);

    this code is normally generated, when a shortcode in a post/page/widget or template file is parsed by wordpress. I guess due to your setup ("externally as an RSS") none of this happens. This is why the map stays blank...

  6. missstyles
    Member
    Posted 1 year ago #

    Hi Robert,

    Thanks for taking a look at it - its turned more into needing more wordpress features as it's gone along.

    The static contact page just has do shortcode section to get to the files:
    <?php require($_SERVER['DOCUMENT_ROOT'] . '/plant-news/wp-load.php'); ?>
    <?php echo do_shortcode( '[mapsmarker layer="1"]' ); ?>
    <?php wp_reset_query(); ?>

    I may just have to bite the bullet and convert that page into a wordpress page which I was trying to avoid!

    Thanks again

  7. RobertHarm
    Member
    Plugin Author

    Posted 1 year ago #

    just for the record ;-)
    please try changing the option where to include javascript files under settings / misc / general settings to "header (+inline javascript)". As your static file doesnt include wp_footer()-template tag, the default method wont work.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic