Forums Forums Search Search Results for 'active_terms 0 name'

Viewing 10 results - 21 through 30 (of 45 total)
  • Author
    Search Results
  • #163335

    Anonymous
    Inactive

    Thank you ! Yes you’re right it displays the entire query ! How to keep only all the [value] results ?

    Array
    (
    [_sfm_prenom-du-commissaire] => Array
    (
    [name] =>
    [singular_name] =>
    [all_items_label] =>
    [type] => post_meta
    [active_terms] => Array
    (
    [0] => Array
    (
    [name] => Anaëlle T.
    [value] => Anaëlle T.
    )

    )

    )

    [_sfm_jour-de-la-visite] => Array
    (
    [name] =>
    [singular_name] =>
    [all_items_label] =>
    [type] => post_meta
    [active_terms] => Array
    (
    [0] => Array
    (
    [name] => Jeudi
    [value] => Jeudi
    )

    [1] => Array
    (
    [name] => Lundi
    [value] => Lundi
    )

    )

    )

    )

    #154736

    Anonymous
    Inactive

    Unfortunately that’s a no-go. The complete code I put in (using your good chunk there) looked like:

    <?php global $searchandfilter;
     
    $sf_current_query = $searchandfilter->get(15)->current_query()->get_array();
    echo '<strong>Filtered by:</strong>';
    
    if ( is_empty($sf_current_query ) ) {
      echo "all";
    } else {
      foreach($sf_current_query as $key) {
      echo '&nbsp; &bull; ' . $key['active_terms'][0]['name'] . ' ';
    }	
    }?>

    Am I missing something above if? Feels like that’s maybe where I’m off?
    (The page does not display anything – no sidebar, no search form, so as-is above it pretty broken – did I close off the function properly?)

    #147706

    In reply to: Taxonomy Breadcrumbs


    Anonymous
    Inactive

    For clarity, this is what I used:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(339)->current_query()->get_array();
    foreach($sf_current_query as $key) {
      echo '<div>' . $key['active_terms'][0]['name'] . '</div>';
    }
    #141086

    In reply to: Some Ui questions


    Anonymous
    Inactive

    ok, great help over skype Trevor – exactly what i was after and pretty much all sorted – thanks!

    for anyone interested

    1. use pre and print r instead of var dump to get the bits you need:

    $sf_current_query = $searchandfilter->get(7050)->current_query();
    	echo '<pre>'; 
    	print_r($sf_current_query->get_array());
    	echo '</pre>';

    2. I ended up with this in my page template to target the ACF meta name chosen in the S&F query – i also ended up trying to cope with the All values parts being sent if no specific options are selected (i hide all items selection in front end):

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(7050)->current_query()->get_array();
    
    if ($sf_current_query['_sfm_comfort']['active_terms'][0]['name'] == ""){
      echo 'no preference for comfort';
    } else {
      echo '$sf_current_query['_sfm_comfort']['active_terms'][0]['name'] . ' comfort';
    }
    #140420

    In reply to: Some Ui questions


    Anonymous
    Inactive

    Hi Trevor, got a little further with styling so thanks for that. One thing with accessing the search data so I can display what’s been searched for – i’ve looked at

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

    but am not getting any output. I’m using ACF meta fields for all the search criteria so maybe I need to use something differently?

    ?_sfm_comfort=medium&_sfm_value_judgement=bestquality&_sfm_state=wa
    is the query string

    i’m using this in the custom page template:

    echo $sf_current_query->get_fields_html(
    array(“_sfm_comfort”)
    );

    echo $sf_current_query->get_field_string(“_sfm_comfort”);

    also doesn’t give any result.

    the var dump gives:
    array(3) { [“_sfm_comfort”]=> array(5) { [“name”]=> string(0) “” [“singular_name”]=> string(0) “” [“all_items_label”]=> string(0) “” [“type”]=> string(9) “post_meta” [“active_terms”]=> array(1) { [0]=> array(2) { [“name”]=> string(6) “Medium” [“value”]=> string(6) “medium” } } } [“_sfm_value_judgement”]=> array(5) { [“name”]=> string(0) “” [“singular_name”]=> string(0) “” [“all_items_label”]=> string(0) “” [“type”]=> string(9) “post_meta” [“active_terms”]=> array(1) { [0]=> array(2) { [“name”]=> string(12) “Best Quality” [“value”]=> string(11) “bestquality” } } } [“_sfm_state”]=> array(5) { [“name”]=> string(0) “” [“singular_name”]=> string(0) “” [“all_items_label”]=> string(0) “” [“type”]=> string(9) “post_meta” [“active_terms”]=> array(1) { [0]=> array(2) { [“name”]=> string(2) “WA” [“value”]=> string(2) “wa” } } } }

    help appreciated – cheers
    Mike


    Anonymous
    Inactive

    Hi Trevor,

    Thanks for the reply, I found the solution:

    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(1274)->current_query()->get_array();
    foreach($sf_current_query as $key) {
    	echo '<span>' . $key['value'] . ' ' . $key['name'] . ' ' . $key['active_terms'][0]['name'] . ', </span>'; 
    	}	
    #122357

    In reply to: Category Description


    Anonymous
    Inactive

    I get the following (you can see a 1 at the end of the array):

    Array
    (
        [_sft_project_category] => Array
            (
                [name] => Product Categories
                [singular_name] => Product Category
                [all_items_label] => All Categories
                [type] => taxonomy
                [active_terms] => Array
                    (
                        [0] => Array
                            (
                                [id] => 6
                                [name] => Fruit
                                [value] => fruit
                                [count] => 7
                            )
    
                    )
    
            )
    
        [_sft_project_tag] => Array
            (
                [name] => Product Tags
                [singular_name] => Product Tag
                [all_items_label] => All Tags
                [type] => taxonomy
                [active_terms] => Array
                    (
                        [0] => Array
                            (
                                [id] => 8
                                [name] => 6+ Months
                                [value] => 6-months
                                [count] => 11
                            )
    
                    )
    
            )
    
    )
    1
    #108703

    Anonymous
    Inactive

    GOT IT!!!

    global $searchandfilter;
    
     $sf_current_query = $searchandfilter->get(504)->current_query()->get_array();
    
     if (empty($sf_current_query)) {
        echo ('All Articles');
        }
     else {
       echo $sf_current_query['_sft_category']['active_terms'][0]['name'];
     }

    The above code worked like a charm, I also use the “Archive” setting as you suggested! Thanks so much for your help on this one!! Finally working properly!! 🙂

    #108628

    Anonymous
    Inactive

    Hi Trevor,

    UPDATE! I’ve managed to half get it working!!!

    It now works for all categories except the “All Categories” one, this seems to behave differently to the others and the code I have used doesn’t bring it in:

    $sf_current_query = $searchandfilter->get(766)->current_query()->get_array();
     echo $sf_current_query['_sft_category']['active_terms'][0]['name'];

    I’ve left the printr statement in on the live site so you can get a picture of what is happening. I presume there may need to be an if statement added but I have yet to be able to pull in the “All categories” heading… I was however thinking of just hard coding a title in as it is only one title?? But i’m not sure how I would do it. I’m sure there is a “proper” fix to this though?

    I hope you have a good weekend

    #95975

    Anonymous
    Inactive

    I found some workaround, to display currently selected value:

    $tmp = $sf_current_query->get_array();
    echo $tmp["_sfm_character"]["active_terms"][0]["name"];
    

    But it may be a bug in get_field_string method from documentation, which is not working in my case:

    echo $sf_current_query->get_field_string("_sfm_character");

Viewing 10 results - 21 through 30 (of 45 total)