Skip Navigation

[Gelöst] Hide Google map if latitude and longitude fields are empty

This support ticket is created vor 8 Jahre, 1 Monat. 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 2 Antworten, has 2 Stimmen.

Last updated by francoiseR vor 8 Jahre, 1 Monat.

Assigned support staff: Luo Yang.

Author
Artikel
#266778

Hi,

I need hide google maps when latitude and longitude fields are empty. I tried with this code

 [wpv-if latitud="wpcf-latitud" longitud="wpcf-longitud" evaluate="$latitud != '' AND $longitud != ''"]
<div id="js-map-element"
     class="team-main"
     data-marker-lat='[types field="latitud" id="$lugar" ][/types]'
     data-marker-lon='[types field="longitud" id="$lugar"][/types]'>
    <div id="js-main-map-canvas" class="google-maps team-map-reduced-height"></div>
</div>
[/wpv-if]

But it doesn't works, it hide always the google map

What I'm doing wrong?

Thanks in advance

#266920

Luo Yang
Supporter

Languages: Englisch (English ) Vereinfachtes Chinesisch (简体中文 )

Timezone: Asia/Hong_Kong (GMT+08:00)

You are using the custom fields from the parent lugar post,

Please try this:

[wpv-if  evaluate="('[types field="latitud" id="$lugar" ][/types]' != '') AND ('[types field="longitud" id="$lugar"][/types]' != '')"]
.... here display the google map
</div>
[/wpv-if]
#267042

Thanks, Luoy! It works perfectly

Great support, as ever