Skip Navigation

[Resolved] Showing childs addresses on a map of a parent post

This thread is resolved. Here is a description of the problem and solution.

Problem: I have a map View filtered by post relationship. Several markers should be included but they don't show up.

Solution: Make sure the marker shortcode is pointing at the correct post in the relationship.

Relevant Documentation:
https://toolset.com/documentation/user-guides/display-on-google-maps/

This support ticket is created 6 years, 2 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 10 replies, has 3 voices.

Last updated by thomasR-9 6 years, 1 month ago.

Assisted by: Christian Cox.

Author
Posts
#1126812

Tell us what you are trying to do?
I have a post, related items to them (actually 2 items). They were shown at the end of the post. Now I want to show the addresses of the items in a map. But this didn't work.

Is there any documentation that you are following?
https://toolset.com/documentation/post-relationships/how-to-display-related-posts-with-toolset/
Can't find information about that.

Is there a similar example that we can see?
No

What is the link to your site?
hidden link

#1126821

To display Child Posts of a certain post you would create a View, where the crucial part is the Query Filter:
"Select [what] in [where] that are related to the Post where this View is shown."

This will then pull whatever post related to the very post where you insert the View.

If you want to display Fields (addresses) of those Child Posts you would create a Map Output in that very view.
https://toolset.com/documentation/user-guides/display-on-google-maps/

#1126886

Hi Beda, I can write you in German, if you want.

here is the code of the view:

[wpv-layout-start]
[wpv-items-found]
[wpv-map-render map_id="map-6"][/wpv-map-render]
<!-- wpv-loop-start -->
[wpv-map-marker map_id='map-6' marker_id='marker-17' marker_field='wpcf-adressen' item='@beitrag-zielpunkt.intermediary'][/wpv-map-marker]
<div class="container wpv-loop js-wpv-loop">
<h3>Unsere besuchten Orte und Menschen</h3>
<wpv-loop wrap="2" pad="true">

[wpv-item index=1]
<div class=" ">
<div class="col-sm-6">[wpv-post-body view_template="Loop item in Zielpunkte für Beiträge"]</div>
[wpv-item index=other]
<div class="col-sm-6">[wpv-post-body view_template="Loop item in Zielpunkte für Beiträge"]</div>
[wpv-item index=2]
<div class="col-sm-6">[wpv-post-body view_template="Loop item in Zielpunkte für Beiträge"]</div>
</div>
[wpv-item index=pad]
<div class="col-sm-6"></div>
[wpv-item index=pad-last]
<div class="col-sm-6"></div>
</div>
</wpv-loop>
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]Es gibt keine besuchten Orte und Menschen für diesen Reisebegleiter-Brief![/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

But nothing happens in the maps. The child items were shown in the page, but not the markers. I used the maps and markers in other pages and it works, but not as a child function.

Best,
Thomas

#1127056

Hi, please add this line of code to your View just after the Marker shortcode:

Test address: [types field='adressen' format='FIELD_ADDRESS'][/types]

Is the address shown on the front-end of the site?

#1127084

Hi, I inserted it after the marker code, see here:

[wpv-layout-start]
[wpv-items-found]
[wpv-map-render map_id="map-6"][/wpv-map-render]
<!-- wpv-loop-start -->
[wpv-map-marker map_id='map-6' marker_id='marker-17' marker_field='wpcf-adressen' item='@beitrag-zielpunkt.intermediary'][/wpv-map-marker]
Test address: [types field='adressen' format='FIELD_ADDRESS'][/types]

<div class="container wpv-loop js-wpv-loop">
<h3>Unsere besuchten Orte und Menschen</h3>
<wpv-loop wrap="2" pad="true">

[wpv-item index=1]
<div class=" ">
<div class="col-sm-6">[wpv-post-body view_template="Loop item in Zielpunkte für Beiträge"]</div>
[wpv-item index=other]
<div class="col-sm-6">[wpv-post-body view_template="Loop item in Zielpunkte für Beiträge"]</div>
[wpv-item index=2]
<div class="col-sm-6">[wpv-post-body view_template="Loop item in Zielpunkte für Beiträge"]</div>
</div>
[wpv-item index=pad]
<div class="col-sm-6"></div>
[wpv-item index=pad-last]
<div class="col-sm-6"></div>
</div>
</wpv-loop>
</div>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]Es gibt keine besuchten Orte und Menschen für diesen Reisebegleiter-Brief![/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

But the result is the same, no markers on the map (see link above). At the moment the view code is with your extra line of code.

Best, Thomas

#1127085

Yes, the addresses are shown in the front-end page.

#1127095

But the result is the same, no markers on the map (see link above)
Right, we didn't change anything in the markers yet. I was just running a test to help pinpoint the issue.

Yes, the addresses are shown in the front-end page.
Okay so we know the address field is being accessed correctly. Try these steps next:
- Temporarily switch to a default theme like Twenty Seventeen and deactivate all plugins except Toolset. Test again.
- If the problem was resolved, reactivate your theme and other plugins one by one until the problem returns.
- Open the browser console and reload the page with the map. Check the browser console for any JavaScript errors.

Let me know the results of these tests, and let me know where I can see this map on your site.

#1127308
Capto_Capture 2018-10-15_07-37-47_AM.png

Hi,

ok, I changed to Twenty Seventeen => same results, no markers

I deactivated all plugins (without Elementor and Toolset plugins) => same results, no markers

Browser console see Upload.

I can give you access to the page.

#1127494

Okay please add login credentials in the private reply fields here. I will be glad to take a look.

#1127589
Screen Shot 2018-10-15 at 12.42.08 PM.png

Okay I see the issue. The Marker shortcode was pointing at the intermediary post type, but the address field is stored on the Zielpunkte post. Zielpunkte is the child in your M2M relationship.
hidden link

Your template code now looks like this:

<h4>[wpv-post-title]</h4>
[types field="homepage"][/types]
[types field="adressen"][/types]
[wpv-map-marker map_id='map-6' marker_id='marker-17' marker_field='wpcf-adressen'][/wpv-map-marker]

Take a look and let me know if it's not working as expected.

#1127625

My issue is resolved now. Thank you! Perhaps an issue for the documentation?