Forums Forums Search & Filter Pro Add info button

Viewing 10 posts - 1 through 10 (of 11 total)
  • Trevor
    #249643

    There is a PHP filter for input fields, but I am unsure whether it could do something as complicated as that:

    https://searchandfilter.com/documentation/action-filter-reference/#filter-input-object

    Anonymous
    #249645

    Ok thanks, I will give it a try

    Trevor
    #249647

    I will wait for you to get back to me.

    Anonymous
    #249730

    Hi Trevor, the function you gave is modifying the filter selectors. Do you have something similar for modifying the filter headings?

    Trevor
    #249734

    I am unsure if it can be. Did you try the code on line 20 here:

    https://gist.github.com/rmorse/7b59b45a14b1ca179868

    Anonymous
    #249737

    That seems more promising than I thought, this must be possible with some JS. Do you know how to get a ACF field from the given function?

    Anonymous
    #249739

    Sorry for my questions, for php I am sort of a beginner

    Trevor
    #249741

    In the code preceding that, you should be able to get the ACF field information you need and save/set that as a string.

    For that you would need help from ACF I would think. It is not something I have done.

    Trevor
    #249743

    I just saw the follow up. This will be hard to do for a beginner, you may need the help of a coder. But see what you can find first.

    This is all I could find:

    https://support.advancedcustomfields.com/forums/topic/how-to-display-field-labels-and-values/

    Anonymous
    #249752

    Ok nice, this is working:

    function filter_function_name($input_object, $sfid)
    {
        $acf_name = substr($input_object['name'],5);
        
    	if(strlen($acf_name)>0)
    	{
    		$input_object['attributes']['title'] = get_field_object($acf_name)['instructions'];
    	}
    	
        return $input_object;
        
    }
    add_filter('sf_input_object_pre', 'filter_function_name', 10, 2);

    It only gives different attribute names based on the field type, for example “title” and “class title” but I wil fix that with JS.

    Thanks a lot!

Viewing 10 posts - 1 through 10 (of 11 total)