Default value select

Forums › Forums › Search & Filter Pro › Default value select

Viewing 6 posts – 1 through 6 (of 6 total)
  • Anonymous
    #260428

    Is there ability to change default select value of a filter, instead of all categories, show second option, without queries??

    i only found how to exclude option from a list but it still returns all the posts of the custom post type, i need it to select 2nd option on load and leave url as it is, messing with code on github –
    filter_function_name($input_object, $sfid){
    }

    how to achieve this?
    Thanks.

    Anonymous
    #260434

    i`m using unset to delete first two option values but i need it to be default, how to do this?? thanks

    function filter_function_name($input_object, $sfid)
    {
    if($input_object[‘name’]==’_sft_tax_news’)
    {
    /*foreach($input_object[‘options’] as $option)
    {
    if($option->value==”maironio-lietuviu-literaturos-muziejus”)
    {
    $option->label = “AAA”;
    $option->attributes[‘class’] = “sf-option-active”;
    $option->attributes[‘selected’] = “selected”;
    }
    }*/
    unset($input_object[‘options’][0]);
    unset($input_object[‘options’][1]);
    return $input_object;
    //udpate this field before rendering
    }
    else{
    echo “NOOO!”;
    return $input_object;
    }
    }
    add_filter(‘sf_input_object_pre’, ‘filter_function_name’, 10, 2);

    filter_function_name(array(‘name’ => ‘_sft_tax_news’),17402);

    Trevor
    #260539

    This has been asked before, but I a sorry, there is no way to preselect the default value/term. This is something we plan to add for V3, due in a few months.

    Anonymous
    #276401

    Has this now been added as a feature?

    Trevor
    #276403

    Not yet, I am sorry.

    Anonymous
    #276499

    Hello Trevor,
    is it still not possible to set default values?

Viewing 6 posts – 1 through 6 (of 6 total)

Search & Filter Support
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

We also use cookies to store items in your cart as well as allowing your to login on the site.

You can adjust all of your cookie settings by navigating the tabs on the left hand side.

By continuing to use this site, you also agree to our Privacy Policy.