Skip Navigation

[Resolved] Styling the distance filter in blocks

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

Sun Mon Tue Wed Thu Fri Sat
- 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 7:00 – 14:00 -
- 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 15:00 – 16:00 -

Supporter timezone: Europe/London (GMT+00:00)

This topic contains 4 replies, has 2 voices.

Last updated by RensV5812 5 years, 1 month ago.

Assisted by: Nigel.

Author
Posts
#1405441

Tell us what you are trying to do?
I'd like to change the look of the distance filter. I would want the fields of the filter displayed horizontally instead of vertically. Also I would want to change the text "show results within ... of". Then I would prefer if the user didn't have the option to pick between km and miles (just km) so no need for this field.
Another question related to this topic: is it possible to only show the placename in a view instead of the whole address? For example instead of showing "Teslastraat 133, 1098 VG, Amsterdam, The Netherlands" just show "Amsterdam".
For reference, the site is a job board so users wouldn't right away be interested in the full address, just a general location is sufficient.

Is there any documentation that you are following?
-

Is there a similar example that we can see?
-

What is the link to your site?
hidden link

#1405447

Update:
I have found the way to change the filter text already.

#1405793

Nigel
Supporter

Languages: English (English ) Spanish (Español )

Timezone: Europe/London (GMT+00:00)

There are no options for styling individual parts of the filter controls other than the label.

Changes that you make to the styling, e.g. coloured borders, would apply to all the inputs.

If you specifically wanted to hide the units selector (km or miles) then you would need to add CSS for that.

There isn't a way to readily add custom CSS to the page.

You could add a custom HTML block to the page and then include the required CSS rules inside style tags, like so:

<style type="text/css">
select[name="toolset_maps_distance_unit"] {
  display: none;
}
</style>

The address field contains the full text of the address as formatted by the Google API, there isn't a way to display just a part of it.

You would need to pass the address through a custom shortcode which used regular expressions to isolate the part you required, and that would depend on a consistent format for all addresses and would be vulnerable to breaking easily.

#1405797

Got it, thanks again for the quick reply.

#1551181

Just another question: how do I change the placeholder value of the distance filter?

Right now it says 'Enter a location'. I want to translate it to Dutch. How would I do it?

Rens