Skip Navigation

[Resolved] Setting up a map in a custom content type template.

This support ticket is created 2 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 8 replies, has 3 voices.

Last updated by katinaA 2 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#2295251

I'm trying to add a map to our custom content type template for Partners following your instructions here:

https://toolset.com/course-lesson/displaying-a-map-on-a-single-post-template/

But the map is not displaying properly on the Partner page. When I go in to edit the partner, the map on that edit page is displaying properly. It is only on the page itself going through the template that it isn't displaying properly. The issue is the map is zoomed in way too tightly.

I see the setting that says Zoom level for one marker. That was initially set at 14. I changed it to 5 but that didn't seem to have any impact.

You can see an example Partner page here:

hidden link

Look at the map block on the right. If you zoom out many times, you can see that it is displaying the marker in the correct place. We just don't want people to have to zoom out many times.

#2295565

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

Screenshot 2022-02-17 at 15.14.53.png

Hi there

It looks like the same marker has been added multiple times to the map (which is why the zoom setting for when there is only one marker is being ignored).

See the screenshot.

I can't see what's responsible for that from the front end, if you check your template now that you know what the problem is, can you see if you have added multiple markers with the same location to the map?

#2295903

It's very possible that I set something incorrectly. I have a LOT of problems with getting things to work right in the block editor. I find it very flaky in how it does things and I often can't tell what it is doing. I now clicked remove this marker several times to get it to where there was no marker. I added a new marker and I now see that it is working. I was able to set the correct zoom level now. The reason there were multiple markers assigned was because I couldn't tell if it was adding it initially. Then I was having problems getting it to save using the Address field. I'd set it up using the Field Group for Partners Address field and Update the view, but then when I'd go back in there, I'd see that it reverted back to the default setting. I had to try it multiple times before I could get the field I wanted it to use to save and stay. So that's why there were multiple markers assigned.

OK, so the zoom part is now working. There is one more thing that I couldn't figure out with the block editor here. Should I post that as a new support thread? Or can we continue with this here? The issue is I wanted this to be a map field within the Fields and Text block above it. Go here again:

hidden link

See how the map is displaying below the section with Map as the title? I'd like it to appear within that section. But the only way I could seem to get the map to appear because of my confusion over what the block editor was doing was by setting it up as a separate block. I'm not seeing any way to move that Map block into the Fields and Text block, nor am I seeing any way to give the Map block a text title.

#2299557

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

You can not move Map's block within the "Fields and Text" block.

If you want to display map without map's block then you should try to display the map using the Map's shortcodes then that shortcodes you can add it to fields and text block:
=> https://toolset.com/documentation/legacy-features/maps-plugin/

To add the title for the map marker, you should add a post title or what ever content/text you want to display as marker hover to the "Hint content (displayed on hover)" section available at bottom right of Maps block as you can see with the following image:
=> https://toolset.com/wp-content/uploads/2020/05/maps-use-a-dynamic-source-for-map-markers.png

#2299973

1. I'm completely confused on the syntax for the shortcodes approach you showed me. Where do I get the shortcode for the specific map I'm wanting to display. I currently have a map block set up below a fields and text block. I want to move that map block to within the fields and text block. Understood if you say I have to do it with a shortcode, but I'm unclear on the syntax needed to get the same map that's currently in the maps block. The sample code in your documentation was:

[wpv-geolocation]wpv-map-render map_id="my-map" map_width="400px" map_height="200px" fitbounds="off" general_zoom="6" single_zoom="15" cluster="on"]

But that didn't work.

2. On this map, when I say title, I'm not talking about a hover hint. I'm talking about setting up the map within a section with a title of "Map" on the page. Go here:

hidden link

Look in the right sidebar. See the area that has Map as the title? I just want the map I'm using to display within the boundaries of the area I've styled that has Map as the title. Currently the map is below it.

#2299991

Please disregard everything in section 2. of my reply above. I got confused between two different support threads. I thought you were talking about how to do something I was asking about in another support thread.

Change what I said in section 2. above to the following:

2. On this map, when I say title, I'm not talking about a hover hint. I'm talking about setting up the map within a section with a title of "Map" on the page. Go here:

hidden link

Look in the right sidebar. See the area that has Map as the title? I just want the map I'm using to display within the boundaries of the area I've styled that has Map as the title. Currently the map is below it.

#2300797

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Ok got it.

What if you add a container block and within the container block add the Heading block to display the Map as heading text and just below that add the block that holds the map:
=> https://toolset.com/course-lesson/container-blocks/

#2302449

That worked! Excellent! I hadn't used a container block before. Glad I now know it's an option. That should solve other future issues where I might have come here for help. Thanks a bunch.

#2302451

My issue is resolved now. Thank you!