How to display Taxonomy in Search Results.php?

Forums › Forums › Search & Filter Pro › How to display Taxonomy in Search Results.php?

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

    Hi! Still loving this plugin. It quickly became a favorite. Quick question: I have results.php with the following else:

    `
    else
    {
    ?>
    <div class=’search-filter-results-list’ data-search-filter-action=’infinite-scroll-end’>
    <h3>We couldn’t find anyone with “<?php
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(4716)->current_query();
    echo $sf_current_query->get_search_term();
    ?>”.</h3>
    </div>
    <?php
    }
    `

    My problem though is that when I sort by a taxonomy, eg orgs or divisions with a drop down cromobox without a search term the "". is left blank. What do I need to add to the above to return the taxonomy/taxonomies?

    Thanks!

    Anonymous
    #200985
    This reply has been marked as private.
    Trevor
    #201022

    Hi

    There is a code back tick on most keyboards; use that once before and once after the code you post. On my keyboard it is the key to the left of the 1 key.

    As to fetching the search terms, the https://searchandfilter.com/documentation/accessing-search-data/ guide is basic but you can extend the idea to grab lost of other data. If you have other filters, then it becomes a little more complex, but I can give you links. This thread might help you:

    https://support.searchandfilter.com/forums/topic/accessing-field-slug-on-search-results/

    … and this search will give similar threads I think:

    https://support.searchandfilter.com/forums/search/sf_current_query+get_array+field+%5Bvalue%5D/

    Anonymous
    #204248
    This reply has been marked as private.
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.