Passer la navigation

[Résolu] Conditionally show distance

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem:
Conditionally show distance

Solution:
You can use the [wpv-conditional] shortcode to display the conditional content based on distance. You can use the shortcode [toolset-maps-distance-value] shortcode to calculate the distance.

You can find the proposed solution in this case with the following reply:
https://toolset.com/forums/topic/conditionally-show-distance/#post-2296415

Relevant Documentation:
- https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#toolset-maps-distance-conditional-display
- https://toolset.com/documentation/programmer-reference/maps/maps-shortcodes/#toolset-maps-distance-value

This support ticket is created Il y a 4 years, 3 months. 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Fuseau horaire du supporter : Asia/Kolkata (GMT+05:30)

Ce sujet contient 4 réponses, a 2 voix.

Dernière mise à jour par MarkJames Il y a 4 years, 3 months.

Assisté par: Minesh.

Auteur
Publications
#2295627

I am trying to conditionally show the distance.

I have a filter to which allows people to find PAs within a certain distance.

[wpv-control-distance distance_unit_url_param="toolset_maps_distance_unit" distance_radius_url_param="toolset_maps_distance_radius" distance_center_url_param="toolset_maps_distance_center" compare_field="address" default_distance="10" default_unit="mi"]

I am using this shortcode to show the distance.

[toolset-maps-distance-value origin_source='url_param' postmeta='wpcf-address' unit='mi']

I want to add more text around this shortcode and only show it if geocoding is being used.

I have tried registering a custom shortcode i.e. https://toolset.com/forums/topic/display-distance-from-location-on-results/ I registered toolset-maps-distance-value and used the shortcode [wpv-conditional if="( '[toolset-maps-distance-value]' ne '' )"]. I have also tried using toolset_maps_distance_center in a shortcode.

Any help would be appreciated.

Mark

#2296147

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I understand, you want to display "distance-value" with some text only if user has perform the search with address - is that correct? if yes:

Can you please share problem URL where you added your view as well as admin access details.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.

I have set the next reply to private which means only you and I have access to it.

#2296415

I stored it by adding the the following.

[wpv-conditional if="( '[toolset-maps-distance-value origin_source='url_param' postmeta='wpcf-address' unit='mi']' ne '' )"]
Distance: [toolset-maps-distance-value origin_source='url_param' postmeta='wpcf-address' unit='mi']miles [/wpv-conditional]

So I used the whole of the shortcode made to show the distance in the conditional.

#2296419

Minesh
Supporter

Les langues: Anglais (English )

Fuseau horaire: Asia/Kolkata (GMT+05:30)

So, I hope you sorted this already or you still require further help.

#2298761

My issue is resolved now. Thank you!