3rd Party Logical Operators
If you’ve added 3rd party fieldtypes to the Toolbox Post Fields, it is providing you with all available logical operators. Sometimes a limited selection is easier to use, so by setting the operators per fieldtype you can limit them.
You can do this by adding a custom filter to your theme’s functions.php:
Loading the gist-code
Remember to merge the new fieldtype’s array with the already existing fieldtypes. The settings for the fieldtype (here: ‘image_aspect_ratio_crop’) take 3 parameters:
operators, the operators that are available for this fieldtype
hasvalue, whether a inputbox for a value needs to be present
hasend, whether an endvalue needs to be present
hasvalue and hasend parameter
Depending on the operators, you will be setting the
hasend parameter. The ‘equals’ operator for instance will need the
hasvalue parameter to be set to true, this way showing an input field so that a value to compare to can be entered. If none of the operators require a second input field you can set the
hasend parameter to false.
Examples of operators that DO need the
hasend parameter to be set to true, are ‘between’, ‘not_between’, ‘within’, ‘not_within’. This will allow a second input field to show when this operator is selected.