Forums › Forums › Search & Filter Pro › Get date range from current archive.php url
Tagged: post_date date daterange
- This topic has 2 replies, 2 voices, and was last updated 10 years ago by
Anonymous.
Viewing 3 posts – 1 through 3 (of 3 total)
-
Anonymous(Private) November 15, 2016 at 11:39 pm #70441
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_ prefixAnonymous(Private) November 16, 2016 at 2:55 pm #70563Trevor,
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!
-
AuthorPosts
Viewing 3 posts – 1 through 3 (of 3 total)