Skip Navigation

[Resolved] Map markers

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

Problem:

It used to work but suddenly stopped displaying the orange markers.

Instead of displaying different markers for each "status" (orange for Wonend, blue for the rest) all markers are blue.

Solution:

The client has noticed that there was one closing shortcode missing: [/wpv-conditional].

Relevant Documentation:

This support ticket is created 6 years, 1 month 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 4 replies, has 2 voices.

Last updated by Luo Yang 6 years, 1 month ago.

Assisted by: Luo Yang.

Author
Posts
#1160043

I have created this view 2 months ago.

It used to work but suddenly stopped displaying the orange markers.

Instead of displaying different markers for each "status" (orange for Wonend, blue for the rest) all markers are blue.

Did I make a mistake in the view code?

[wpv-layout-start]
[wpv-items-found]
[wpv-map-render map_id="map-1" map_height="500px"][/wpv-map-render]<!-- wpv-loop-start -->
<wpv-loop>
[wpv-conditional if="( $(lvgo_status_woongroep) eq 'Wonend' )"]
[wpv-map-marker map_id="map-1" marker_id="marker-[wpv-post-id]" marker_title="[wpv-post-title]" marker_field="wpcf-adres-woongroep" marker_icon="hidden link" ]
<h3>[wpv-post-link]</h3>
[wpv-conditional if="( $(lvgo_adres_woongroep) ne '' )"][types field='lvgo_adres_woongroep'][/types]<br>[/wpv-conditional]
[wpv-conditional if="( $(lvgo_postcode_woongroep) ne '' )"][types field='lvgo_postcode_woongroep'][/types][/wpv-conditional]
[wpv-conditional if="( $(lvgo_plaatsnaam_woongroep) ne '' )"][types field='lvgo_plaatsnaam_woongroep'][/types]<br>[/wpv-conditional]
info:
[wpv-conditional if="( $(lvgo_naam_contactpersoon) ne '' )"][types field='lvgo_naam_contactpersoon'][/types]<br>[/wpv-conditional]
[wpv-conditional if="( $(lvgo_btelefoon) ne '' )"][types field='lvgo_btelefoon'][/types]<br>[/wpv-conditional]
[wpv-conditional if="( $(lvgo_bemail) ne '' )"][types field='lvgo_bemail'][/types][/wpv-conditional]
[/wpv-map-marker]
[/wpv-conditional]

[wpv-conditional if="( $(lvgo_status_woongroep) eq 'Initiatief' )"]
[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-adres-woongroep' marker_icon="hidden link"] <h3>[wpv-post-link]</h3>
[wpv-conditional if="( $(lvgo_adres_woongroep) ne '' )"][types field='lvgo_adres_woongroep'][/types]<br>[/wpv-conditional]
[wpv-conditional if="( $(lvgo_postcode_woongroep) ne '' )"][types field='lvgo_postcode_woongroep'][/types][/wpv-conditional]
[wpv-conditional if="( $(lvgo_plaatsnaam_woongroep) ne '' )"][types field='lvgo_plaatsnaam_woongroep'][/types]<br>[/wpv-conditional]
info:
[wpv-conditional if="( $(lvgo_naam_contactpersoon) ne '' )"][types field='lvgo_naam_contactpersoon'][/types]<br>[/wpv-conditional]
[wpv-conditional if="( $(lvgo_btelefoon) ne '' )"][types field='lvgo_btelefoon'][/types]<br>[/wpv-conditional]
[wpv-conditional if="( $(lvgo_bemail) ne '' )"][types field='lvgo_bemail'][/types][/wpv-conditional]
[/wpv-map-marker]

[wpv-conditional if="( $(lvgo_status_woongroep) eq 'Bouwend' )"]
[wpv-map-marker map_id='map-1' marker_id='marker-[wpv-post-id]' marker_field='wpcf-adres-woongroep' marker_icon="hidden link"] In oprichting: [wpv-post-link][/wpv-map-marker]
[/wpv-conditional]

</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-layout-end]

#1160466

Hi,

It seems to be a problem of nested shortcode, you are using such kind of nested shortocde:

[wpv-conditional ...]
[wpv-map-marker ... ]
[wpv-conditional ...]...[/wpv-conditional]
[/wpv-map-marker]
[/wpv-conditional]

It might conduct unexpected result,

I suggest you create two content templates, for example:
- wonend-ct
- Initiatief-ct

put the the [wpv-map-marker] shortcode content into those content template, and display the content template inside the top level [wpv-conditional] ... [/wpv-conditional], like this:

[wpv-conditional if="( $(lvgo_status_woongroep) eq 'Wonend' )"]
[wpv-post-body view_template="wonend-ct"]
[/wpv-conditional]
[wpv-conditional if="( $(lvgo_status_woongroep) eq 'Initiatief' )"]
[wpv-post-body view_template="Initiatief-ct"]
[/wpv-conditional]

More help:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-post-body

#1160694

Hi Luo,
I dit as you suggested. However, the problem persisted.
Then I inspected my code again and I noticed that there was one closing shortcode missing: [/wpv-conditional].
That resolved the problem, both in my original view (with nested shortcodes) and in the new view (with 2 content templates).
Thank you anyway, my problem is solved.

#1160695

My issue is resolved now. Thank you!

#1161217

Thanks for sharing the solution.