How to get slug from S&F current_query() selected taxonomy?

Forums › Forums › Search & Filter Pro › How to get slug from S&F current_query() selected taxonomy?

Viewing 4 posts – 1 through 4 (of 4 total)
  • Anonymous
    #274754

    Hi,

    I have managed to return the selected taxonomy string when I filter the posts. I would like to know how can I return the slug also?

    My code:

    <?php
    global $searchandfilter;
    
    $sf_current_query = $searchandfilter->get(909)->current_query();
    
    $sf_args = array(
        "str" 					=> '%2$s',
        "delim" 				=> array(", ", " - "),
        "field_delim"				=> ', ',
        "show_all_if_empty"			=> false
    );
    
    $current_selected_taxonomy = $sf_current_query->get_field_string("_sft_thema", $sf_args);
    ?>
    
    <?= $current_selected_taxonomy ?>

    Thanks!

    Trevor
    #274777

    I am not sure I understand. Can you give me an example URL with query strings, and explain what part of that you are trying to fetch, and what you need to do with it?

    If this helps, details of the search filters set/chosen can be found, but it requires some detective work (specific to your form) and then some coding.

    See this post:

    https://support.searchandfilter.com/forums/topic/display-list-of-filters-currently-set/#post-264202

    Trevor
    #274806

    Thanks for getting back to me. I will close this thread for now.

Viewing 4 posts – 1 through 4 (of 4 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.