Hook to return Modified Filter Name

  • 8 months ago #35300

    Hi, Can you help me with some filter to modify the filter title, based on some condition.. I will add the condition, need the filter to modify the Filter name. As I am planning to use same filter, but name has to be different on some pages.

    wpsolr
    Keymaster
    8 months ago #35302

    WPSOLR_Events::WPSOLR_FILTER_UPDATE_FACETS_DATA, which contains all the content sent to the .twig rendering template.

    Or WPSOLR_Events::WPSOLR_FILTER_SEARCH_PAGE_FACET_NAME, with an example in /plugins/wpsolr-pro/wpsolr-pro/wpsolr/pro/extensions/acf/class-wpsolr-plugin-acf.php

    8 months ago #35303

    Can you provide an example, got this filter :

    add_filter( WPSOLR_Events::WPSOLR_FILTER_SEARCH_PAGE_FACET_NAME, [
        $this,
        'get_field_label',
    ], 10, 1 );

    I am looking to rename a filter with name Geography to Country…

    wpsolr
    Keymaster
    8 months ago #35304

    You can check into /plugins/wpsolr-pro/wpsolr-pro/wpsolr/pro/extensions/acf/class-wpsolr-plugin-acf.php

    8 months ago #35312

    Thank you, working fine.

    8 months ago #35321

    Just one more thing, Any option to hide facets on some pages, if hiding not possible, any filter to add custom class to facets ?

    wpsolr
    Keymaster
    8 months ago #35322

    There is WPSOLR_Events::WPSOLR_FILTER_FACETS_TO_DISPLAY. Remove the facets you want to hide.
    Example in file wpsolr/pro/extensions/woocommerce/class-wpsolr-plugin-woocommerce.php.

    8 months ago #35359

    Thank you, it worked

    8 months ago #35360

    Is it possible to hide the taxonomies inside the filters too ? Suppose if expand the Filter A , we have 10 taxonomies, can we remove one from them ? Any filter in use in the code ?

    wpsolr
    Keymaster
    8 months ago #35361

    With WPSOLR_Events::WPSOLR_FILTER_UPDATE_FACETS_DATA, which contains all the content sent to the .twig rendering template.

    An example in wpsolr/pro/extensions/seo/class-wpsolr-option-seo.php

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

You must be logged in to reply to this topic.