Skip Navigation

[Resolved] show toolset-maps-distance-value conditionaly

This support ticket is created 3 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 5 replies, has 2 voices.

Last updated by herbie4 3 years, 1 month ago.

Assisted by: Shane.

Author
Posts
#2181055

Tell us what you are trying to do?

I want to show the distance only when there is a location from a custom field. So I was trying to use the [wpv-conditional] but I can't get it to show. Not using the conditional it works fine. But I want to hide it when the distance value is empty.
This is the code I tried.

[wpv-conditional if="( '[toolset-maps-distance-value origin_source='url_param' postmeta='wpcf-member_address']' ne '' )"]
Afstand: [toolset-maps-distance-value origin_source='url_param' postmeta='wpcf-member_address'] km<br />
[/wpv-conditional]

Hope you can help me.

#2181195

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Herbie,

Thank you for getting in touch.

In this case you will need to do the conditional like below.

[wpv-conditional if="( '[types field='member_address'][/types]' ne '' )"]
Afstand: [toolset-maps-distance-value origin_source='url_param' postmeta='wpcf-member_address'] km<br />
[/wpv-conditional]

Thanks,
Shane

#2181229

Hi Shane,
Thank you.
Unfortunatly that will not work as the member_address field is never empty as this is the address field for maps.
So I need a way to check if the toolset-maps-distance-value is set or not. Or to see if the location filter (form field: toolset-maps-distance-center) is populated...

Hope you can help.

#2181283

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Herbie,

Perhaps you can try getting the value of the distance field from the URL using this shortcode.
https://toolset.com/documentation/programmer-reference/views/views-shortcodes/#wpv-search-term

If you provide me with a link to the search I should be able to let you know what the parameter is.

Thanks,
Shane

#2181557

Thank you Shane.
That pointed me to the right solution.
I am now using [wpv-conditional if="('[wpv-search-term param="toolset_maps_distance_center"]' ne '')"] and that works fine!

#2181561

My issue is resolved now. Thank you!