WP Manifestindependent plugin directory
manifest / content / acf-extended-range-selector-field-wordpress-plugin

ACF Extended Range Selector Field GitLab self-updates

Adds an ACF field with a styled range slider that captures either a single value or a min/max pair.

by Viktor Kovalenko · gitlab.com/v_kovalenko/acf-extended-range-selector-field-wordpress-plugin · website

0stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://gitlab.com/v_kovalenko/acf-extended-range-selector-field-wordpress-plugin/-/archive/master/acf-extended-range-selector-field-wordpress-plugin-master.zip

Ships its own WordPress updater (built-in updater), so new versions show up under Dashboard → Updates.

Adds an Extended Range Selector field type to Advanced Custom Fields: a styled slider that captures either a single number or a minimum/maximum pair.

Built on noUiSlider 15.8.1 (MIT), vendored minified under assets/vendor/.

Requirements

  • WordPress 6.2+
  • PHP 7.4+
  • ACF or ACF PRO 6.x (built against ACF PRO 6.8.10)

Installation

  1. Copy the acf-extended-range-selector-field folder to wp-content/plugins/.
  2. Activate ACF Extended Range Selector Field under Plugins.
  3. In ACF → Field Groups, add a field and pick Extended Range Selector from the Custom Field Types category.

Field settings

Tab Setting Notes
General Selection Type Single Value (one handle) or Range (Min / Max) (two handles).
General Default Value Single mode only. Used when the field has no stored value.
General Default Minimum / Maximum Range mode only.
General Return Value Value, Always Array or Formatted String. See below.
Validation Minimum / Maximum Value Defaults to 0 and 100. Values outside the range are clamped, never stored.
Validation Minimum / Maximum Gap Range mode only. Smallest and largest allowed distance between the two handles.
Presentation Step Size Defaults to 1. Decimal steps are supported; inputs and labels follow the precision.
Presentation Style Pin, Pill (default) or Square.
Presentation Accent Colour Empty follows the admin colour scheme. Only #rgb / #rrggbb is accepted.
Presentation Tick Scale None, One tick per step (capped at 11 labels) or Start and end only.
Presentation Show Value Tooltips Value bubble above each handle while dragging.
Presentation Show Numeric Inputs Number inputs beside the slider for exact values. On by default.
Presentation Prepend / Append Shown beside the inputs and inside tooltips.

Stored value

Mode Stored as
Single a number
Range array('min' => 3, 'max' => 8)

Range values are kept in one meta row, so they are not usable in a numeric meta_query. When you need to query on them, mirror the two numbers into their own meta keys:

<?php
add_action('acf/save_post', function ($post_id) {
    $range = get_field('price_range', $post_id, false);

    if (is_array($range)) {
        update_post_meta($post_id, 'price_range_min', (float) $range['min']);
        update_post_meta($post_id, 'price_range_max', (float) $range['max']);
    }
}, 20);

Return values

<?php
// Return Value: Value
$score = get_field('score');        // single mode: 42
$price = get_field('price_range');  // range mode:  ['min' => 3, 'max' => 8]

// Return Value: Always Array — single mode returns ['min' => 42, 'max' => 42]
// Return Value: Formatted String — "$3 - $8" with Prepend "$"

Empty fields return null.

Switching Selection Type

Changing Selection Type on a field that already holds data does not lose it:

  • Single → Range: the stored number is placed on both handles.
  • Range → Single: the stored minimum is kept.

The conversion happens on load, so existing posts keep working before they are re-saved.

Conditional logic and REST API

  • Usable as a conditional logic trigger with Has any value, Has no value, Value is equal to, Value is not equal to, Value is greater than and Value is less than. In range mode the comparison uses the minimum handle.
  • With Show in REST API enabled, single mode exposes a bounded number and range mode an object with min and max properties.

Filter: cdl_extended_range_selector_accent_color

Override the accent colour for every field of this type:

<?php
add_filter('cdl_extended_range_selector_accent_color', function (string $color, array $field): string {
    return '#6d4aff';
}, 10, 2);

The filtered value still has to pass sanitize_hex_color(), so it can only ever produce a colour.

Accessibility

  • Each handle is a role="slider" with an aria-label and a spoken value that includes Prepend/Append.
  • Arrow keys step, Page Up/Down jump, Home/End go to the bounds.
  • The numeric inputs accept typed values and are constrained on blur.
  • Focus rings are never removed, and prefers-reduced-motion disables handle animation.

Notes

  • The plugin registers the custom field category label only when no other plugin has done so, so it can run alongside ACF Iconic Radio Group.
  • Despite the name, this plugin is unrelated to the ACF Extended (ACFE) plugin and shares no prefixes with it.

License

GPLv2 or later. noUiSlider is MIT; see assets/vendor/nouislider/LICENSE.md.