Skip Navigation

[Resolved] Markers are not displaying in my custom post loop

This support ticket is created 7 years, 3 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
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 16 replies, has 2 voices.

Last updated by Nigel 7 years, 2 months ago.

Assisted by: Nigel.

Author
Posts
#556391

I have multiple posts in a custom post type. All of the posts have addresses in them.

I think everything is set up correctly, but the markers are not showing up.

'[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-post-body view_template="Loop item in Mission Map"]
</wpv-loop>
<!-- wpv-loop-end -->
[wpv-map-render map_id="missions-map" map_width="100%" map_height="100vh" fitbounds="off" single_zoom="4" cluster="on"]
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]'

'[wpv-map-marker map_id="missions-map" marker_id="marker-[wpv-post-id]" marker_field="wpcf-mission-location"][/wpv-map-marker]'

I don't see anything wrong with this.

Please help!

#556399
map-capture.JPG

I turned on the debug for this view, and the Output Raw for all but 1 of the posts is returning a blank for the marker.

I also added just the [wpv-post-id], and the ID is output just fine.

Please see the screenshot.

Any clue why this is happening?

#556433

Now there is absolutely no output, and I don't know why. Everything seems to be set up correctly.

#556436

I changed my view to this ... still nothing:

'[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop>
[wpv-post-body view_template="Loop item in Missions Map"]
</wpv-loop>
<!-- wpv-loop-end -->

[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-map-render map_id="missions-map" map_width="100%" map_height="100vh" cluster="on"]
[wpv-layout-end]'

----------------

'[wpv-map-marker map_id="missions-map" marker_id="marker-[wpv-post-id]" marker_field="wpcf-mission-location"]

<h3>[wpv-post-title]</h3>
View Full Mission

[/wpv-map-marker]'

#556443

Changing themes did nothing, and disabling all other plugins did nothing.

#556523

Nigel
Supporter

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

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

Hi Michael

It's not very easy for me to see what the issue is based on the above.

Can I take a look at your site to see the set-up directly?

I will mark your next reply as private so that I can get log-in credentials from you—you may want to create a temporary admin user for me to use that you can later delete. And be sure to have a current backup of your site.

Can you confirm the View affected and the page you have added it to?

#556619

Nigel,

I just stumbled upon the solution. I would still like your feedback though.

I took one last look at the address field in the post, and for whatever reason, I decided to grab the marker, and move it slightly on the map.

The address field lit up green as though it was save, and then the markers started showing up.

FYI, I am not putting addresses in, I am just putting locations in different Countries (Africa, Guatamala, India, Africa, etc.) ...

Is there something special I have to do to lock the address/location in once I put it in the address field? There is no save button, so I just assumed it would lock itself in when I pushed publish/update on the post.

Your input would be appreciated.

#556622

Another thing I noticed ...

If I drag and drop the marker in the address field slightly, and press "update" the marker shows up on the map.

If I move the marker slightly, and then press the "use this address" button under the map in the address field, and then press "update", the marker disappears.

It seems that your system doesn't like non-latitude and longitude entries, such as physical address, or a city, state combination.

Can you confirm?

#556624

Nigel
Supporter

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

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

Hi Michael

What is supposed to happen is that you add an address custom field to a post, and when editing that post enter an address in the field. It will auto-fill the address as you start typing and you accept one of the addresses that Google recommends. Then when you save the post the address is stored in the post meta, and the corresponding lat/lon coordinates for that address are stored elsewhere by Views.

The key part is accepting the address Google suggests, which means it will then retrieve the corresponding coordinates. When you type a place, such as a country, are you accepting the auto-fill recommendation from Google?

#556645

Nigel,

Yes, I click on the suggestion, and update, but the marker does not show up until I move the marker slightly (and the top address field is filled with exact coordinates) ...

If I try to move the marker, and then click the "use this address" button, it also doesn't work.

The only way the marker stays on the map from my view is if I move the marker, and then press update.

Please test this, and let me know.

Thank you.

#556646

I just did this process again ...

I started typing, I chose a suggestion, I press update...

When I scroll back to the address field, it is blank. EDIT ... I meant the field is empty, and there is no marker on the view map.

It is not locking in my selection for some reason.

There are no console errors.

#557570

Nigel
Supporter

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

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

Hi Michael

Sorry for the delay getting back to you, yesterday was a public holiday.

I've just been testing the address field in the manner you describe, saving countries such as "India" or "China" using the auto-suggestion, and I didn't experience any problems, the addresses are saved.

You say you already tried switching theme and disabling plugins.

Can I get a copy of your site to test locally?

I'll mark your next reply as private so you can share the URL of a site duplicate (https://toolset.com/faq/provide-supporters-copy-site/) or, if you prefer, let me have site credentials and I will take a copy from your site myself. Be sure to have a current backup first.

#559656

Nigel
Supporter

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

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

Hi Michael

Sorry, I didn't get a notification about your reply, which I have now seen.

I have downloaded the duplicate and am installing it now. I will look at it first thing in the morning and update you then.

Thanks for your patience.

#559843

Nigel
Supporter

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

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

Screen Shot 2017-08-15 at 08.38.27.png
Screen Shot 2017-08-15 at 08.37.55.png

Hi Michael

I'm not sure what the issue is.

I installed the site locally.

I went to look at a Missions post and saw that rather than an address (or country) the address fields were all coordinate pairs (presumably resulting from you manually adjusting the markers).

The adjacent maps were not displaying because of restrictions from your API key, so I replaced that with an unrestricted key.

I then went through the 8 Mission posts and updated the address fields with country names, as shown in one of the attached screenshots.

I then looked at the map page, and all 8 markers displayed correctly.

In short, I couldn't reproduce the problem.

The only material difference between your version of the site and mine is the API key, you might want to try removing the restrictions on your key for testing to see if that is the root of the problem.

I think every maps question I have dealt with has always been resolved by fixing the settings for the API key. I didn't think that was going to be the case from your description, but it looks like it might be.

#561739

Nigel,

It seems that the Maps for Views plugin has an issue when you restrict the API key to the domains you are using.

The fact that I wouldn't be able to use the Google API domain restrictions is a bug in my opinion. If someone wanted to use your API key, the domain restriction is the only thing stopping them from sticking you with a pretty nasty bill for all the data they stole.

Basically, with restrictions, the map does not lock in the markers. Without restrictions it does.

You mentioned that you used an unrestricted API key. This might be why you couldn't reproduce the issue.

Can you lock your API key down using your local website url, so you can confirm?

Thank you.