Skip Navigation

[Resolved] Distance feature: Display in one line and only show km?

This thread is resolved. Here is a description of the problem and solution.

Problem: I would like to display the distance filter fields for a custom search View on a single line, in horizontal format. I would also like to hide the distance unit select field and show only the unit text 'km' instead of the select field and options for other units.

Solution: Be sure the distance filter block is added to the Block Editor in a grid block, a container, or other block element set to the full width you want to cover with this row of filters. Add custom CSS to resize the inputs as needed, and adjust the styles for a custom solution.

This support ticket is created 3 years, 6 months 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 6 replies, has 3 voices.

Last updated by anandS-4 3 years, 6 months ago.

Assisted by: Christian Cox.

Author
Posts
#2048877
Screenshot 2021-05-09 at 02.20.46.png

Tell us what you are trying to do?
I am trying to display the Distance feature in one single line.

Is there any documentation that you are following?
https://toolset.com/forums/topic/styling-distance-feature-how-to-display-on-one-line-and-only-show-km/

There is a solution to this problem but I am unable to solve it on my website.

Is there a similar example that we can see?
It's in the real estate example.

What is the link to your site?
hidden link
Password: Apricus@123

Waqar has solved this issue. Please look into my site if possible and resolve it asap. My assignment is due on Monday. Please help.

#2049461

Hello, I am not seeing the "distance-search-block" CSS class added to the distance filter as shown in the other ticket:
https://nimb.ws/gLpEfO
That's the first thing I would check in the View editor screen. If it's still not working as expected after adding the required CSS class to the filter block, I may need to log in and take a closer look. Please provide login credentials in the private reply fields here.

#2051089

Shane
Supporter

Languages: English (English )

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

Hello,

Christian is currently on a public holiday today but he will be back tomorrow to continue assisting you with this one.

Thank you for the patience and understanding.

#2052099
Screen Shot 2021-05-11 at 12.57.47 PM.png

You should edit the page containing the View. I believe it is here:
hidden link

In the Block Editor, you should select the Custom Search Filter block that contains the distance filter. In the sidebar, open the Advanced panel and add the CSS class in the CSS Classes field. Type the classname and then type Enter or Return to set the class. Then save the Page.

I am attaching another screenshot here for you. You can see the distance filter block selected, and the CSS Class input field in the Advanced sidebar panel.

#2052681
Screenshot 2021-05-12 at 13.23.22.png

I see you have added the CSS for this particular problem but it didn't resolve my issue.

I still see the distance block in multiple lines.

#2053233

I see you have added the CSS for this particular problem but it didn't resolve my issue.
That is odd, because if I remember correctly this CSS code was already added when I checked the site on May 9...I do not recall adding this CSS myself. The CSS is added in the Customizer's Additional CSS panel, but I do not remember adding it myself. I remember seeing the CSS but not seeing the classname added to the filter, so that is why I recommended adding the CSS classname next. Anyway, not a big deal but it's strange that you are under the impression I added the code.

It looks like the Submit and Cancel buttons were in the same grid row as the distance filter elements. That prevented the inputs from extending full-width. I moved the distance filter block above the grid containing the submit and cancel buttons, and removed the 220px top-margin from both of those buttons. I hope that's okay, I assume this is what you want to achieve here. Let me know if I misunderstood, but I think you need the full-width here to display all the distance filter elements in one line.

Here are the changes I made in the Customizer's CSS panel. The main problems were the width of the distance number input and the display mode of the nested .form-group element. I also hid the "km" select field since the other ticket discusses adding the text with JavaScript.

.distance-search-block .form-group .form-group {
display: block;
}

.distance-search-block.wpv-custom-search-filter>* input[type=number] {
	width: 70px;
}

.distance-search-block.wpv-custom-search-filter .js-toolset-maps-distance-unit {
	display: none;
}
 
.distance-search-block .js-toolset-maps-distance-center {
width: 43% !important;
}

You can adjust this code as needed to tweak the design, it's just an example.

#2053731

My issue is resolved now. Thank you!