• Resolved Florence

    (@floortjahh)


    Hi! I’m building a page where I would like one term to always be auto-selected when the user opens the page. How can I achieve this with Filter Everything?

    • This topic was modified 2 years, 3 months ago by Florence.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support fesupportteam

    (@fesupportteam)

    Hi @floortjahh

    Only by the link with the term selected. Basically, on the needed page with the filters choose the term and use that URL address for your shop page, so when a client opens the page this filter term will be selected by default.

    Best Regards – Victor

    Thread Starter Florence

    (@floortjahh)

    Hi! Thanks for a quick reply! My question is slightly different. I don’t want the page without a selection to even exist – only pages with a selection. What do I do in that case? I tried redirecting the page without selection to a page with a selection, but that caused an error: “This page isn’t working Redirected you too many times”

    • This reply was modified 2 years, 3 months ago by Florence.
    • This reply was modified 2 years, 3 months ago by Florence.
    Plugin Support fesupportteam

    (@fesupportteam)

    Hi @floortjahh

    Only with custom coding, the plugin does not have such functionality as it would require redirecting from certain pages to the ones with additional parameters. This is not something that we can help with, as our plugin does not have such redirection rules.

    There are a lot of different approaches to that. As one of the options, here is an example of a shop page that will redirect to the page with some parameters:

    // Add custom rewrite rule
    function custom_rewrite_rule() {
        add_rewrite_rule('^shop/?$', 'index.php?pagename=shop&myparameter=1', 'top');
    }
    add_action('init', 'custom_rewrite_rule', 10, 0);
    
    // Add custom query var
    function custom_query_vars($vars) {
        $vars[] = 'myparameter';
        return $vars;
    }
    add_filter('query_vars', 'custom_query_vars', 10, 1);
    
    // Redirect /shop/ to /shop/?myparameter
    function custom_shop_redirect() {
        if (is_shop() && get_query_var('myparameter') !== '1') {
            wp_redirect(home_url('/shop/?myparameter=1'));
            exit();
        }
    }
    add_action('template_redirect', 'custom_shop_redirect');
    

    Best Regards – Victor

    Thread Starter Florence

    (@floortjahh)

    Gotcha. I thought of a workaround. Thanks!

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Auto-select radiobutton’ is closed to new replies.