Forums Forums Search & Filter Pro Wrap filter items in a div

Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #160225

    Hi, I’m trying to wrap <li> items in the filter in a div so I can easily apply an accordion to them. I’ve been using sf_input_object_pre to modify the prefix and postfix but they don’t seem to insert anything into the HTML – can someone confirm what these attributes do? And if they don’t insert any prefix or postfix, is there a way I can add HTML to the filter list?
    Thanks.

    function filter_function_name($input_object, $sfid) {
    
    	if($input_object['type']!='checkbox') 	{
    		return $input_object;
    	}	
    	foreach($input_object['options'] as $key => $option) {
    		if ($option->attributes['class']="sf-level-0") {
    		      $input_object['options'][$key]->prefix = '<div>';
                          $input_object['options'][$key]->postfix= '</div>';
    		}
    	}
    	
    	return $input_object;
    }
    add_filter('sf_input_object_pre', 'filter_function_name', 10, 2);
    Trevor
    #160257

    At this version of the plugin, what you want is not supported, and would have to be done using a custom jQuery script. This will be addressed when we release V3 later this year.

    Anonymous
    #160307

    Thank you for your reply. Would my best bet be to insert custom classes using sf_input_object_pre then use jquery to insert html around them?

    Trevor
    #160311

    If you need to add classes to the elements inside the <li> then that would be best. To add elements around the form elements you would need to use jquery.

    Trevor
    #199655

    Hi Katherine.

    Ross, our developer, has offered to write some code to help you with this. I think what he proposes is to write code that would make the field heading an accordion title, if that is OK?

Viewing 5 posts - 1 through 5 (of 5 total)