Advertisement
Guest User

Untitled

a guest
May 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. if ( $query->is_search ) {
  2. if ($_REQUEST['search_type'] == 'wycieczki' ) {
  3. $curr_month = date('m');
  4. $curr_year = date('Y');
  5. if ($_REQUEST['abc'] != "all" && isset($_REQUEST['abc'])) {
  6.  
  7. $chosen_month = date($_REQUEST['abc']);
  8.  
  9. if ($curr_month < $chosen_month) {
  10. $query_date_start = date("01"."/".$chosen_month."/".$curr_year);
  11. $query_date_end = date("t"."/".$chosen_month."/".$curr_year);
  12. }
  13.  
  14. if ($curr_month >= $chosen_month) {
  15. $query_date_start = date("01"."/".$chosen_month."/".($curr_year + 1));
  16. $query_date_end = date("t"."/".$chosen_month."/".($curr_year + 1));
  17. }
  18.  
  19. $query->set('meta_query', array(
  20. 'relation' => 'AND',
  21. array(
  22. // 'key' => 'trip_start_date',
  23. //// 'value' => array( $query_date_start, $query_date_end),
  24. // 'value' => $query_date_start,
  25. // 'compare' => '=',
  26. // 'type' => 'DATE''key' => 'trip_start_date',
  27. 'key' => 'trip_start_date',
  28. // 'type' => 'DATE',
  29. 'value' => '12',
  30. 'compare' => 'LIKE'
  31. )
  32. )
  33. );
  34.  
  35. }
  36. }
  37. //
  38. // $query->set('post_type', array(
  39. // 'wycieczki'
  40. // ));
  41.  
  42. }
  43.  
  44. return $query;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement