Navigation überspringen

[Gelöst] How to set default distance and unit using toolset maps distance filter

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

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 vor 6 Jahren, 5 Monaten. 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 -

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

Dieses Thema enthält 3 Antworten, hat 3 Stimmen.

Zuletzt aktualisiert von martinD-7 vor 6 Jahren, 5 Monaten.

Assistiert von: Minesh.

Author
Artikel
#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

Sprachen: Englisch (English )

Zeitzone: 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:
=> versteckter Link

#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