Hi,
I created a CPT called "Places", in which I intend create a post per place, for the places I want to show.
In the Place post, I want to show a map with a marker for that location, as well as other views related to that post.
My question is regarding creating a layout that has a map in it, and I need to input the marker location per post.
I tried to build a layout, but could not find a map block or option.
I could insert a visual editor, then add a map shortcode to it, but I would have thought that you have a better way to do so.
Also, I intend to fill the marker information using CSV import (using the plaugin called WPAllimport Pro).
I saw an article about specifying the marker source as "dynamic" and pick from a custom field.
My questions in this point are:
1- does this work with a layout template? (the article was for a single post).
2- if I have some places as an address, and some as coordinates, what's the best approach?
If there are any guidance regarding how to start this layout, I'd be very appreciative.
thanks a lot.
Hello,
Q1) does this work with a layout template? (the article was for a single post).
Yes, you are right, there isn't Map cell or marker cell within Layouts plugin, see our document:
https://toolset.com/documentation/user-guides/layout-editor-cells/
So, you can setup a visual editor cell or content template cell, and display the Map shortcode + Marker shortcodes, it is the same result.
And there is a map block within Toolset Blocks plugin, you can download it here:
https://toolset.com/account/downloads/
You can use it to setup a Toolset Map block, and use your custom address field as the marker's Dynamic source, see screenshot map-block.JPG.
Q2) if I have some places as an address, and some as coordinates, what's the best approach?
I assume we are talking about a custom address field created with Toolset Types + Maps plugins.
If it is, the custom address fields requires input address in text format, in your case, you can try these:
1) Add two other custom numeric fields:
- Latitude
- Longitude
2) In your layout, create a visual editor cell, and display the map + marker shortcodes.
use above two custom numeric fields, as the source of marker shortcodes, for example:
<p>[wpv-map-render map_id="map-3"][/wpv-map-render]</p>
<p> </p>
<p>[wpv-map-marker map_id='map-3' marker_id='marker-2' lat='[types field='latitude' output='raw'][/types]' lon='[types field='longitude' output='raw'][/types]'][/wpv-map-marker]</p>