Forums Forums Search & Filter Pro displaying search terms without labels

Viewing 10 posts - 1 through 10 (of 17 total)
  • Anonymous
    #45816

    hi,
    i’m using the Accessing the Search Data instructions to display the search terms in the heading.
    everything is working fine. the only problem is i can’t seem to find a way to remove the label and display only the search term alone.
    i’m using the echo $sf_current_query->get_field_string function

    would really appreciate help on this issue.

    thanks, eli.

    Trevor
    #45831

    I have a feeling that you are asking a question similar to that asked in the thread that my solution in this post is found:

    https://support.searchandfilter.com/forums/topic/how-to-style-the-search-data/page/2/#post-43915

    I appreciate that some of the posts in that thread are marked as private, but I think the gist of it all is there. The user had a search and then the actual search terms used were repeated, without labels. Where a search term had not been used, it would not appear in this.

    Anonymous
    #45832

    hi trevor, this is exactly what i needed.
    thanks’s so much!!!.
    another thing is that i’M always displaying 2 search terms and i want an & sign between tham

    Trevor
    #45833

    You would have to echo the ampersand between them.

    The code in that post was specific to that user. If you are ALWAYS displaying the same 2 you have no need to loop through the array. Instead you could call them directly.

    It took me quite a while to do that code, I am sure you can modify it.

    Anonymous
    #46954

    hi Trevor,
    i have tried to call them directly as you offered but it keeps showing me either both together or non of them. would really appreciate a direction on how to get it done properly.

    regards, eli.

    Trevor
    #46955

    Whoops, posted the reply to the wrong thread 🙁

    Trevor
    #46957

    What code did you use? Make sure that any code you post here, you put a code tag (in the editor toolbar) before AND after the code, otherwise the code will be stripped and changed by the forum posts editor 🙁

    Anonymous
    #46958
    This reply has been marked as private.
    Trevor
    #46959

    OK

    I have re-written that a bit and added a new line after each line output. It may not work, but it is better code:

    <?php
      global $searchandfilter;
      $sf_current_query = $searchandfilter->get(2327)->current_query()->get_array();
      if (isset ($sf_current_query)) {
        foreach($sf_current_query as $key) {
          echo '<span class="results-term">' . $key['active_terms'][0]['name'] . '</span><br />';
        }
      }
    ?>
    Anonymous
    #46960

    hi,
    i don’t think this would help me. what i need is to display each taxonomy separately (so i can control the order) and show the name of the active term for each taxonomy. this way i can add any connecting word or sign between the terms.

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