Navigation überspringen

[Gelöst] Split: Split: Filter Single Taxonomy via Checkbox – make custom checkbox filter as toggle button

This support ticket is created vor 1 year, 10 months. 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 -

Zeitzone des Unterstützers: Asia/Kolkata (GMT+05:30)

Dieses Thema enthält 1 reply, hat 2 Stimmen.

Zuletzt aktualisiert von Minesh vor 1 year, 10 months.

Assistiert von: Minesh.

Author
Artikel
#2708164

This is awesome. Thank you. One finally request.

Would it be possible to instead of a checkbox for AND / OR to have a toggle / radio button.

UX wise it would be preferable.

#2708166

Minesh
Unterstützer

Sprachen: Englisch (English )

Zeitzone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

With your view:
- versteckter Link

I've adjusted the code under "Search and Pagination" section:

<div class="form-group">
  <label for="wpv-custom-and">[wpml-string context="wpv-views"]OR (Default) / AND [/wpml-string]</label>
	<div class="form-check">
      <label class="toggle">
        <input type="checkbox" id="wpv_control_checkbox_wpcf-and" class="js-wpv-filter-trigger form-check-input" name="wpv-wpcf-and" value="AND"  [set_field_checked url_param="wpv-wpcf-and" value="AND"]>
         <span class="slider"></span>
            </label>
        
        </div>
</div>

Added the following CSS code to CSS editor:

.toggle {
            position: relative;
            display: inline-block;
            width: 60px;
            height: 34px;
        }
         
        /* Hide the checkbox input */
        .toggle input {
            display: none;
        }
         
        /* Describe slider's look and position. */
        .slider {
            position: absolute;
            cursor: pointer;
            top: 0;
            left: 0;
            right: 0;
            bottom: 0;
            background-color: gray;
            transition: .4s;
            border-radius: 34px;
        }
         
        /* Describe the white ball's location 
              and appearance in the slider. */
        .slider:before {
            position: absolute;
            content: "";
            height: 26px;
            width: 26px;
            left: 4px;
            bottom: 4px;
            background-color: white;
            transition: .4s;
            border-radius: 50%;
        }
         
        /* Modify the slider's background color to 
              green once the checkbox has been selected. */
        input:checked+.slider {
            background-color: green;
        }
         
        /* When the checkbox is checked, shift the 
              white ball towards the right within the slider. */
        input:checked+.slider:before {
            transform: translateX(26px);
        }