Hello, if I understand correctly you would like to change the behavior of the map marker. When the marker is clicked, you would like to open the marker popup (this is called an InfoWindow in Google Maps) and also load the main post content in the area where the View currently appears. I think this is a great idea, but unfortunately there is nothing exactly like this built-in to the Views and Blocks plugins and it would require some complex custom code. You and I have discussed a similar request in the past: https://toolset.com/forums/topic/custom-post-content-near-of-the-map/ Unfortunately it is still not possible to control content outside the map based on click events inside the map.
This level of customization falls outside the scope of support I can offer here in the forums. If you are a JavaScript, HTML and CSS developer, I can show you some examples that might help you implement something similar to your requirements. If you are not a developer, then the following alternative requires less custom code but is still quite complex and will be challenging to implement.
As an alternative, you could change the template for DLS posts so that it looks more like the template for the de-loire-en-seine page. Remove the "J’Y PENSE" sidebar (or place the sidebar content below the post content instead) and add the map on the left side instead. I can help you add some custom code that will automatically open the popup of the current post when the page loads. Nigel created some custom code in another ticket, and I can help you implement this code with a few minor changes: https://toolset.com/de/forums/topic/maps-open-popup-on-start-load/
So the new flow would be:
- User goes to hidden link
- User clicks a map marker
- Popup appears containing link to post
- User clicks link to post
- User is redirected to the DLS post. The new DLS post template looks much like the de-loire-en-seine page. The map appears on the left side and the post content appears on the right side.
- The Map Marker popup for the current post is automatically opened
It depends on how the markers are added to the map. Are the markers inserted in a classic View, or in a View created in the Blocks editor? If it's a classic View, can you share the contents of your Loop and any Loop templates used in the View? If it's created in Blocks, can you share some screenshots of the Marker configurations from the Block Editor?
Okay I assume you have created this marker using the Map block in the Block editor. If that is the case, I see the problem and I can replicate it on my own test site. Any shortcode you place in the popup content editor will save correctly once, but then it will be replaced with the rendered content and display the contents from the same post no matter which marker you click. In other words, if you place this code in the popup content editor panel of the Map block in a View created in a Content Template assigned to some CPT:
[wpv-post-title]
...then save the template, on the front-end of the site the post title will be displayed correctly for all markers. This will work correctly for all posts and all markers until you edit and resave the template in wp-admin. Then you will see that the shortcode has been replaced with the title of the preview post, for example:
la rigueur du commerce, la joie du déversoire
Now if you resave the template, this hard-coded post title is saved in the template instead of the shortcode. I will escalate this to my 2nd tier support team for some additional investigation. Until the problem is resolved by our developers, you should turn off the marker created by the Map block and recreate the marker with a shortcode. You can do this by editing the View in the block editor and adding a Fields and Text block inside the View's loop block. Edit the Fields and Text block and you can use the "Add a Field or View" button (see my field-or-view.png screenshot here for an example) to insert a Marker shortcode. In the "Marker data" tab, you can insert your popup contents using shortcodes and HTML as needed (see popup.png). I can't tell exactly what your shortcodes should be based on the images I have seen so far, but I imagine the post title with link will be included in an h4 tag, for example:
<h4>[wpv-post-link]</h4>
Now that the marker is included with a shortcode, use the "Remove this marker" link in the Map block to remove the broken marker attached to the Map block (see the remove.png screenshot here for an example). Let me know if this is too confusing, I'll be glad to login to your wp-admin area and make the required changes. I have activated private reply fields here so you share login credentials securely, if necessary.
Hi, I'm afraid I misunderstood the problem, can you help? You said: But in the second map on the markers popup I have the same content everywhere. hidden link;
Can you clarify this for me? When I click the markers on this map, I see different content in each marker popup. See the screenshots here for examples. I thought I saw a problem in wp-admin where the content for all popups was repeated, but a coworker pointed out that the text in the popup editor is highlighted in yellow, indicating a shortcode which will be replaced dynamically. On the front-end I cannot see a problem.
I see now, the problem is not apparent until I log out of the site. Please stand by, I am still working on this and I will give you another update shortly.