• Resolved yankiara

    (@yankiara)


    Hi,

    I would like to customize select filter default option because text is too long and redondant with filter title.

    I found filters in documentation, but they don’t seem to include the default option, only the actual taxonomy terms.

    How can I do this, please?
    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support fesupportteam

    (@fesupportteam)

    Hi @yankiara

    You can use this code example, placing it in the functions.php file of your theme or using the code snippets plugin:

    // Define a custom function to modify the default option text
    function custom_dropdown_default_option($default_option, $filter) {
        // Modify the default option text as needed
        $modified_default_option = sprintf(__('My custom text: %s', 'filter-everything'), $filter['label']);
    
        return $modified_default_option;
    }
    
    // Hook the custom function to the 'wpc_dropdown_default_option' filter
    add_filter('wpc_dropdown_default_option', 'custom_dropdown_default_option', 10, 2);

    Change the “My custom text: ” to the needed text. The “%s” will show your attribute/taxonomy/custom field title name.

    Best Regards – Victor

    Thread Starter yankiara

    (@yankiara)

    Hi,

    Awesome, this is perfect!
    Is there a list of all hooks somewhere in documentation?

    Thanks for your great support!
    Yan

    Plugin Support fesupportteam

    (@fesupportteam)

    Hi @yankiara

    There are some hooks here – https://filtereverything.pro/resources/hooks/

    The documentation is still under development, we haven’t gotten around to adding all of them with examples. Also, since there are quite a few new ones to be implemented in the plugin, and this process is still in progress, we are collecting all the information on how to implement them most conveniently to add the ability to change almost every aspect of the plugin’s functionality in one way or another.

    Best Regards – Victor

    Thread Starter yankiara

    (@yankiara)

    Yes I’ve seen this page, thanks.
    And good luck with documentation!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘How to customize select default option text?’ is closed to new replies.