Forum Replies Created
-
AuthorPosts
-
Hi,
Sorry for my late reply, for some reason I didn’t get an email notification about this topic.
If you’d like to reach out via the contact form, I’ll be happy to trace the issue for you.
Hi,
I don’t use WP Rocket, so I don’t know exactly how to prevent it from mangling scripts, but I can tell you all the MapPress JS files that may be used in the frontend.
Have you tried switching on the iframes option in the MapPress settings? That might also work.
MapPress itself only has 1 file. Note that it’s “index_mappress” not “mappress_index“:
/build/index_mappress.jsThe google clustering library is included with the plugin, and it’s loaded if you use clustering:
lib/js-markerclustererplus-main/modified-clusterer.jsThe Leaflet engine and clustering are loaded from unpkg, if you use Leaflet:
leaflet.js
leaflet-omnivore.min.js
leaflet.markercluster.jsThanks, the link was helpful.
The plugin will auto-generate maps for you, so there’s no extra step. But you’d need to use the mashup, along with its ‘filter’ button and POI list for the results. You can see the map on my home page for an example.
If you need to do something custom: the map is now a React component, so the imperative interfaces (e.g. setPois) are gone. If you’re interested in loading React on the page, I can explain how to display the map POIs using ReactDom.render() : https://reactjs.org/docs/react-dom.html#render
If the above solutions don’t work, then you may want to remain on 2.75 for now, and I’ll look into adding an external interface (web component or imperative methods) for a future release.
Hi,
I think it would be easier to just let MapPress generate the necessary maps, and use a mashup block to display them. You could then use the standard filtering/query by post type & taxonomies.
But if you’d like to use the filter, the example code below worked for me (I added it to the theme’s ‘functions.php’).
function myfilter($map, $args) { $poi = new Mappress_Poi(array('title' => 'mypoi', 'point' => ['lat' => 22, 'lng' => 23])); $map->pois = [$poi]; return $map; } add_filter('mappress_post_query', 'myfilter', 10, 2);You can also use filter ‘mappress_query_pois’ which just replaces the POIs. There’s an example of using that filter in ‘mappress_frontend.php’, which fetches POIs from data stored in the Advanced Custom Fields plugin.
Ok.
I’ve removed the buggy shortcode tab for the mashup block. It worked for earlier versions, but the block now supports queries that are too complex to use in a shortcode.
I don’t know how the invalid JSON was created, but if you’d like to provide a step-by-step I’ll try to reproduce the problem.
I know what you mean about not wanting a map for each post, but those maps don’t need to be displayed – they just need to exist and be linked to the post in order to generate a mashup.
The maps are now React components, so JavaScript methods like setPois are no longer present. But it’s still possible to set the POIs from PHP. Filter ‘mappress_post_query’ can be used to modify the results for a mashup map. The filter is applied when a mashup query is run, see plugin file ‘\pro\mappress_query.php’. The filter is called with a map object and the original query, and you can use it to set the POIs for the map.
If you need more info, please let me know.
Hi,
That JSON doesn’t look valid. MapPress uses the WordPress wp_query module, so those are the parameters that are supported.
Instead of entering raw JSON, try just using the post type using the checkboxes for the mashup block. That should give something like this (for a ‘location’ custom post type):
{
"post_type": [
"location"
]
}It’s not possible to generate a mashup directly from custom fields. You have to first create a map for each post, based on the custom fields. Once the individual post maps exist, you can create a mashup combining all of the maps together.
https://mappresspro.com/mappress-documentation/#toc-generating-maps-from-custom-fields
I was able to reproduce the crash when displaying the shortcode, which occurs because the JSON is invalid, and it’ll be fixed ASAP in version 2.83.8. Thanks for reporting it!
Hi,
I replied to you via email, but in case you’re looking here:
The setting “popup content” (in the MapPress settings) is set to show data from POIs.
When that setting is set to “POI title + body + images”, all the info comes from the POI itself – title, body and images. If you want to use the POIs this way, you can add the image to the POI itself in the map editor.
If you want to instead use the underlying post, just change the setting to “Post title + excerpt + featured image”. This will pick up the featured image from the post.
I haven’t been able to replicate the problem. But if you’d like to send a login I’ll see if I can trace it in your system (or a staging system with the same problem). You can contact me here.
You can also check for theme/plugin conflicts:
1. Deactivate ALL other plugins and switch to the standard “twenty twenty” theme.
2. Create a test post with a thumbnail
3. Check if the new thumbnail is displayed on the mashupHi,
Normally just using the settings in the ‘thumbnails’ section will make thumbnails appear for the (single) featured image attached to each post.
The ‘{{{poi.thumbnail}}}’ token is no longer used.
Are you using standard WordPress thumbnails? Or are thumbnails controlled by the theme or a plugin?
Hi,
All three of these changes are now in version 2.80. #1 was implemented by outputting the HTML even when the filters are closed (as it did before). You should be able to control it using CSS as before. I hope to implement a better solution eventually, but it will take some time to implement.
2.80 is a beta version, and it includes a database upgrade. Please make a database backup before installing it. To download the new version you’ll need to enable beta updates in the MapPress settings OR download and install it manually from your account: http://mappresspro.com/account. Install instructions are on that page.
If you have any problems, please contact me directly using the contact form so I can fix them immediately.
Hi,
Thanks for writing. You make some good points.
1) I’ll look into adding an option to always display the filters, without toggling, for the next release.
2) Mashups were previously restricted if the ‘search’ option was selected, but not if it was disabled. In the current release it always restricts. I’ll reinstate the old functionality.
3) It’s not possible to add that markup, but I’ll add a separate checkbox to display directions in the list.
Hi,
That wasn’t a scenario I considered, but it does make sense. I’ve just released version 2.77.2, which should allow you to both enable hover and open posts in a new tab.
Thanks for reporting this.
Hi,
If you are displaying posts on the category/term pages, any maps in those posts will display – but the plugin shouldn’t add any widgets.
If you think it’s a widget, here are two things to check:
1 – confirm you haven’t added a widget somehow (in the WP appearance -> editor menu)
2 – turn off automatic map display in the MapPress settings
Hi,
I looked and there is no map on the page, but it’s hard to say why. There are several JavaScript errors on the page (F12 to open the console in most browsers), but I don’t know if they’re related. One indicates another plugin or the theme is loading the Google Maps API multiple times.
Could you please try with all other plugins deactivated and a standard theme (like ‘twenty twenty’)? If you still don’t see the map, you can contact me directly and send a login. If you do see the map, reactivate one by one to find the conflict.
Hi,
There’s no limit to the number of maps that can be displayed, but the maps must be attached to a post.
Using the shortcode will display a map, but it doesn’t attach it to a post.
You can use the map editor to attach the map, and then it will show in the mashup.
-
AuthorPosts
