- This topic has 2 replies, 2 voices, and was last updated 9 years, 2 months ago by .
Viewing 3 posts - 1 through 3 (of 3 total)
Viewing 3 posts - 1 through 3 (of 3 total)
These forums are now closed and remain for historical purposes.
None of the content applies to the new version 3. For support, get in touch via our contact form.
Forums › Forums › Search & Filter Pro › Get date range from current archive.php url
Tagged: post_date date daterange
https://domainnamehere.com/resources/?_sft_resourcetype=press-releases&post_date=01012016+12312016
I’ve had success getting the query variable for the taxonomy term “press-releases” using the code below, but cannot successfully retrieve the date range, either aggregated or individually as from date and to date. Can you enlighten me?
global $searchandfilter;
$sf_current_query = $searchandfilter->get(5277)->current_query();
$type = $sf_current_query->get_field_string("_sft_resourcetype"); //returns press-releases
$daterange = $sf_current_query->get_field_string("post_date"); // returns nothing
Have also tried:
$daterange = $sf_current_query->get_field_string("_sfm_post_date"); // returns nothing, even with url reflecting _sfm_ prefix
Trevor,
Between this and another support post that I located, this was indeed the solution:
$sarr = $sf_current_query->get_array();
$fromDate = $sarr[_sf_post_date][active_terms][0][value] ;
$toDate = $sarr[_sf_post_date][active_terms][1][value];
Thanks!