woof_regulate_by_only_show
Filters the 'show' value for individual filter items when the 'by_only' shortcode attribute is used, primarily needed for the price filter whose view depends on this value (1-5).
Parameters
$val (mixed) — The default value (typically 1 for most filters, or intval of the price filter's show setting)
$by_only_key (string) — The key identifier of the filter item being regulated (e.g. 'by_price', 'by_featured')
Source File
index.php:3039
Code Example
add_filter('woof_regulate_by_only_show', function($val, $key) {
if ('by_price' === $key) {
return 2; // Show price as a select dropdown
}
return $val;
}, 10, 2);
Usage Notes
- Only fires when the 'by_only' shortcode attribute is set and not empty.
- The price filter ('by_price') has view types 1-5 (slider, select, text, radio, etc.) making this hook specifically relevant for it.
- Part of the shortcode rendering flow at woof.php shortcode.