Forums Forums Search & Filter Pro https://searchandfilter.com/documentation/accessing-search-data/

Viewing 5 posts - 1 through 5 (of 5 total)
  • Anonymous
    #199207

    Hello,

    I have s&f pro on elementor and I like to show the tags/cats of the filtered results.

    I found this page: https://searchandfilter.com/documentation/accessing-search-data/
    But the PHP string is not working on my page, I just see a part of the string where I would like to have the meta of the filtered posts.

    Used this code and put it in a text and html field, both same results:

    <?php
    //grab the active query from our search form
    //replace 1526 with the ID of your search form
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(REPLACED WITH S&F ID)->current_query();

    ?>

    Trevor
    #199219

    You are not using our integration guide for Elementor?

    https://searchandfilter.com/documentation/3rd-party/elementor/

    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/

    Note that (as far as I know) you cannot run PHP in Elementor elements. It has to be inside a PHP template, or inside a shortcode that can run PHP (there are such plugins out there that let you make shortocdes that use PHP).

    Anonymous
    #199239

    Hello Trevor,

    Thank you for responding. Yes I use the integration guide, you have helped me in the past with that.

    Maybe I did not explain it well enough, sorry for the language barrier.

    My filter is working super, but what I like to do is when I have filtered results I want to show above the results what tags or categories they have filtered on.

    Something like: “You have searched on these tags and cats: #sun, #moon, Fish

    Is that also doable with shortcode?

    Trevor
    #199241

    That is what I understood, but it requires custom PHP coding, for which you would need to hire a freelance coder if you cannot do it yourself (but I did points towards some pages that contain snippets that would help). This plugin:

    https://wordpress.org/plugins/post-snippets/

    Allows you to make some PHP code and create it as a shortcode to place on the page.

    Anonymous
    #199251

    Super Trevor, I will look into it! Thanks for your help!

Viewing 5 posts - 1 through 5 (of 5 total)