Skip Navigation

[Résolu] Display checkbox search filters in one line

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

Problem: I have a series of search filters displayed as checkboxes. The checkboxes are displayed in a single column with several rows. Instead, I would like to display the checkboxes in a single row with multiple columns. If I inspect the checkbox containers I can see they are set to display:inline-block; but they break to separate rows. How can I display the checkboxes in a single row?

Solution: Use custom CSS to override the default layout styles for the checkbox elements. In this case, applying display:flex to the checkboxes container element is sufficient to implement the flexbox model and display the filters in a single row with multiple columns.

Relevant Documentation:
https://css-tricks.com/snippets/css/a-guide-to-flexbox/

This support ticket is created Il y a 2 années et 10 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 3 réponses, has 2 voix.

Last updated by jillT Il y a 2 années et 10 mois.

Assisted by: Christian Cox.

Auteur
Publications
#2094457
toolset.JPG

I have a search page that will show the results for a custom taxonomy. The type of control is 'set of checkboxes'. This displays the results in a column format, one under the other (see attached image). I am trying to get them to display in one line, next to each other.

On inspecting the element, it shows the classes .wpv-custom-search-filter-label-bottom .wpv-custom-search-filter__input, .wpv-custom-search-filter-label-top .wpv-custom-search-filter__input have display:inline-block;

Are you able to advise me how to get them inline?

#2094947

Hello, I would need to see this in the browser to inspect the different styles applied to these elements. Those can vary based on the theme and other plugins involved here, so there is no one solution that will always work. Can you provide a URL and login if necessary where I can see the search filters?

#2095977
Screen Shot 2021-06-22 at 2.10.38 PM.png

Okay the ancestor .form-group div establishes the flexbox model for its descendents, as you can see in the inspector (screenshot attached, see the "flex" indicator in the DOM inspector next to .form-group ancestor div). The two direct descendants are the "Filter by" label and the span container for the checkboxes. You should add display:flex on the span container to establish the flexbox model for its direct descendent elements, then manipulate the flex properties of the checkbox descendent elements to achieve columns. Add the following CSS to the View to set display:flex on the span container:

.wpv-custom-search-filter-label-bottom .wpv-custom-search-filter__input, .wpv-custom-search-filter-label-top .wpv-custom-search-filter__input {
  display: flex;
}

That will bring the checkbox descendants into one row. You may need to add some margins/padding to the individual elements to achieve the desired, something like this:

.form-check {
  padding-right: 15px;
}
.form-check-label {
  margin-left: 5px;
}

If you'd like a quick guide for using the flexbox design model, check out this CSS Tricks article: https://css-tricks.com/snippets/css/a-guide-to-flexbox/

#2096323

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.