Forums Forums Search Search Results for 'sf_current_query get_array'

Viewing 3 results - 91 through 93 (of 93 total)
  • Author
    Search Results
  • #31935

    Anonymous
    Inactive

    So I’ve been trying to pull the field name from the Active Query Object, but I’m not able to pull any of custom fields, just categories.

    I’m able to get _sft_credit_card_category, but not the post_meta fields of _sfm_issuer and _sfm_credit_quality.

    
    <?php
    //grab the active query from our search form
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(615)->current_query();
    var_dump($sf_current_query->get_array());
    
    echo $sf_current_query->get_field_string("_sft_credit_card_category");
    echo $sf_current_query->get_field_string("_sfm_issuer");
    echo $sf_current_query->get_field_string("_sfm_credit_quality");
    ?>
    
    #30635

    Anonymous
    Inactive

    Hey Ross,

    Did you try it on the results.php located in the avada theme folder /search-filter ?

    I tried this again with the following two codes;

    <?php
    //Get an array of objects containing data for the current search/filter
    //replace 1526 with the ID of your search form
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(14458)->current_query();
    var_dump($sf_current_query->get_array());
    ?>

    and

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

    ?>

    Neither are able to pull the values I need.

    I’d like to turn the Categories In: line to not be bulleted and be on the same line. If I can pull the category then it would be fine.

    I tried the above codes at the top of the results.php and neither worked.

    Any idea why ?

    #26959

    Anonymous
    Inactive

    Just an update.
    I tried to use following code but it seems that a function does not exists:

    <?php
    //Get an array of objects containing data for the current search/filter
    //replace 1526 with the ID of your search form
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1526)->current_query();
    var_dump($sf_current_query->get_array());
    ?>

    ERROR: Fatal error: Call to a member function get() on a non-object in …

Viewing 3 results - 91 through 93 (of 93 total)