Skip Navigation

[Resuelto] How to set default distance and unit using toolset maps distance filter

Este hilo está resuelto. Aquí tiene una descripción del problema y la solución.

Problem:
How to set default distance and unit using toolset maps distance filter

Solution:
You can use attribute default_distance and default_unit with maps distance filter shortcode [wpv-control-distance] to set default default distance and unit.

For example:

[wpv-control-distance default_distance="20" default_unit="mi" compare_field="town" distance_center_url_param="toolset_maps_distance_center" distance_radius_url_param="toolset_maps_distance_radius" distance_unit_url_param="toolset_maps_distance_unit" inputs_placeholder="Within 20 miles of %%CENTER%%"]

Relevant Documentation:

This support ticket is created hace 6 años, 4 meses. 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.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

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 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Este tema contiene 3 respuestas, tiene 3 mensajes.

Última actualización por martinD-7 hace 6 años, 4 meses.

Asistido por: Minesh.

Autor
Mensajes
#957103

I'm concerned that there is no restriction on the value users can enter for the 'search within' value. This means a user could enter, for example, 1000 miles and return every single post from my database. Not good from the point of view of server load or giving a competitor valuable information about my customers!!!

So I have the following questions:-

How do I remove the ability to for users to change the default distance value on the frontend?

OR

How do I restrict the number of posts returned?

If you can suggest a different or better solution, I'm all ears.

Thank you

#957218

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Well - you can adjust the attribute inputs_placeholder to remove the distance input textbox.

For example:

inputs_placeholder="Show results within of %%CENTER%%"

Full shortcode example:

[wpv-control-distance compare_field="your-field" distance_center_url_param="toolset_maps_distance_center" distance_radius_url_param="toolset_maps_distance_radius" distance_unit_url_param="toolset_maps_distance_unit" inputs_placeholder="Show results within of %%CENTER%%"]

To set default distance radius - you can edit the distance query filter as shown with the following image:
=> enlace oculto

#957240

Played around with your shortcode but no posts being returned. I re-added the shortcode using the 'new filter' button and for some reason the shortcode it produced added the default distance value like this:-

[wpv-control-distance default_distance="20" default_unit="mi" compare_field="town" distance_center_url_param="toolset_maps_distance_center" distance_radius_url_param="toolset_maps_distance_radius" distance_unit_url_param="toolset_maps_distance_unit" inputs_placeholder="Within 20 miles of %%CENTER%%"]

and now it works!

Excellent - thank you ?

#1221173

Hi There.

is it possible only to show KILOMETERS and having NO dropdown with km AND miles? We do not need miles in Germany.
Thanks