Forums › Forums › Search & Filter Pro › Rebuild Cache & All Categories
Tagged: all categories removal, cache
- This topic has 62 replies, 3 voices, and was last updated 6 years ago by
Trevor.
-
Ross Moderator(Private) July 10, 2019 at 12:42 pm #215959
Hi Mark
This would be the CSS, although how it works may vary from browser to browser:
.searchandfilter .sf-field-category select option:first-child{ display: none; }This assumes that it is the field/class
.sf-field-categorythat needs this applying to… You can inpsect the form (using your browsers dev tools) to find the class names of other fields you might want to do this to.However, I would recommend the PHP way using our filter to ensure consistency across browsers etc (add to functions.php):
function filter_input_object($input_object, $sfid){ if(($input_object['name']!='_sft_category')) { return $input_object; } //if we want to filter the options generated, we need to make sure the options variable actually exists before proceeding (its only available to certain field types) if(!isset($input_object['options'])) { return $input_object; } //now we know there are options we can go ahead anre remove the firlst option array_shift($input_object['options']); return $input_object; } add_filter('sf_input_object_pre', 'filter_input_object', 10, 2);In this example, I have used the same field (category), but using the URL fieldname –
_sft_category.Thanks
Anonymous(Private) July 10, 2019 at 12:47 pm #215967I tried the CSS way and it added a new blank field but didn’t get rid of the All Categories, see here: http://colerainefhs.org.uk/?page_id=245567
-
AuthorPosts