Forums Forums Search & Filter Pro Rebuild Cache & All Categories

Viewing 10 posts - 21 through 30 (of 63 total)
  • Anonymous
    #213878

    Thanks Ross,

    i understand the site is now creaking a bit with the volume of posts – if nothing else at least you can extreme test your plugin 🙂

    just checked at 9.40am and it’s at 50%

    Anonymous
    #213970
    This reply has been marked as private.
    Ross Moderator
    #214524
    This reply has been marked as private.
    Anonymous
    #215816
    This reply has been marked as private.
    Anonymous
    #215957
    This reply has been marked as private.
    Ross Moderator
    #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-category that 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

    Ross Moderator
    #215961
    This reply has been marked as private.
    Anonymous
    #215967

    I 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

    Ross Moderator
    #215969
    This reply has been marked as private.
    Anonymous
    #216010
    This reply has been marked as private.
Viewing 10 posts - 21 through 30 (of 63 total)