Forums Forums Search & Filter Pro How to get Posts count from current_query

Tagged: 

Viewing 10 posts - 1 through 10 (of 13 total)
  • Anonymous
    #33356

    Hi, I need to display posts count next to labels, cant find it anywhere in this query.
    global $searchandfilter;
    $sf_current_query = $searchandfilter->get(XXXX)->current_query();
    var_dump($sf_current_query->get_array());

    what should I do in order to achieve this?

    thanx

    Ross Moderator
    #33444

    Currently you cannot retrieve this info here, however it seems like a nice to have.

    Working through some updates now to the active query class – I’ll see if I can easily get this in there.

    Thanks

    Anonymous
    #33458

    It would be great, I’m working on some graphs to visualize search results and this feature would be great for this implementation, when do you plan to release this update?

    thank you

    Ross Moderator
    #33460

    Just added this in dev, can I send to you to test?

    Thanks

    Anonymous
    #33463

    yes please, will do that later today and get back to you

    thanks

    Ross Moderator
    #33464

    Just emailed you.

    Thanks

    Anonymous
    #33664

    Hi, tried it and it works great. Is there a way/function to get automatic post count for all other taxonomy terms, not just picked ones? Just like in widget but raw data.

    Ross Moderator
    #33879

    Hey there

    There is some code, however I would mention that this is not documented and is liable to change once I give more thought on the best way to make this data available:

    global $searchandfilter;
    $searchform = $searchandfilter->get(1234);
    $count = $searchform->get_count_var('_field_name', 'field_value');

    Replace 1234 with the Search Form ID, and replace field named and field value (these are both found in the URL if you perform a search a specific field/value)

    Thanks

    Anonymous
    #33912

    Hi, this works great!!!
    thank you very much

    Anonymous
    #40595

    Hi, I’ve just noticed that this doesn’t work anymore, did you change something in new version? $searchform->get_count_var('_field_name', 'field_value');
    Is there new, better way to get this data?

    Thanks

Viewing 10 posts - 1 through 10 (of 13 total)