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)