Forums › Forums › Search & Filter Pro › How to get Posts count from current_query
Tagged: results count
- This topic has 12 replies, 3 voices, and was last updated 9 years, 1 month ago by
Anonymous.
-
Anonymous(Private) January 5, 2016 at 1:41 pm #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(Private) January 6, 2016 at 12:40 am #33444Currently 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
Ross Moderator(Private) January 6, 2016 at 12:22 pm #33460Just added this in dev, can I send to you to test?
Thanks
Ross Moderator(Private) January 11, 2016 at 12:16 pm #33879Hey 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
-
AuthorPosts