Display post meta from search field.

Forums › Forums › Search & Filter Pro › Display post meta from search field.

Viewing 10 posts – 1 through 10 (of 10 total)
  • Anonymous
    #34929

    Hi
    How to display post meta (ACF) from search form?
    Regards

    Ross Moderator
    #34951

    Do you mean what the user has selected?

    Check: http://www.designsandcode.com/documentation/search-filter-pro/accessing-search-data/

    Thanks

    Anonymous
    #34979

    Im trying something like and its not working

    <?php
    //Get a single fields values using labels
    //replace 1526 with the ID of your search form
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(147)->current_query();
    echo $sf_current_query->get_field_string(“_sfm_xxx”);

    ?>

    Url looks like this:
    http://www.xxx.com/?_sfm_xxx&#8230;

    Ross Moderator
    #34987

    Can you send me a link?

    Thanks

    Anonymous
    #34998

    Website is actually offline.

    I just put in page template:
    <?php
    //Get a single fields values using labels
    //replace 1526 with the ID of your search form
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(147)->current_query();
    echo $sf_current_query->get_field_string(“_sfm_xxx”);

    ?>

    and Its echo nothing. I’m using ACF fileds

    Ross Moderator
    #35186

    Hey Arek

    Thats looks correct. Without being able to access the site its going to be hard to help further.

    When you use this field in a search, does that work correctly?

    If you check your php / errorlogs, do you see anything in there?

    Thanks

    Anonymous
    #35221

    The problem is that there is no php errors 🙂

    Ross Moderator
    #35222

    And you’ve enabled WP DEBUG?

    Anonymous
    #35565

    Yes. Still Nothing I don’t know why

    Ross Moderator
    #35604

    what happens if you var_dump the array:

    <?php
    //Get a single fields values using labels
    //replace 1526 with the ID of your search form
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(147)->current_query();
    var_dump($sf_current_query->get_array());
    ?>

    CAn you paste the output here?

    Thanks

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