Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( $query->is_search ) {
- if ($_REQUEST['search_type'] == 'wycieczki' ) {
- $curr_month = date('m');
- $curr_year = date('Y');
- if ($_REQUEST['abc'] != "all" && isset($_REQUEST['abc'])) {
- $chosen_month = date($_REQUEST['abc']);
- if ($curr_month < $chosen_month) {
- $query_date_start = date("01"."/".$chosen_month."/".$curr_year);
- $query_date_end = date("t"."/".$chosen_month."/".$curr_year);
- }
- if ($curr_month >= $chosen_month) {
- $query_date_start = date("01"."/".$chosen_month."/".($curr_year + 1));
- $query_date_end = date("t"."/".$chosen_month."/".($curr_year + 1));
- }
- $query->set('meta_query', array(
- 'relation' => 'AND',
- array(
- // 'key' => 'trip_start_date',
- //// 'value' => array( $query_date_start, $query_date_end),
- // 'value' => $query_date_start,
- // 'compare' => '=',
- // 'type' => 'DATE''key' => 'trip_start_date',
- 'key' => 'trip_start_date',
- // 'type' => 'DATE',
- 'value' => '12',
- 'compare' => 'LIKE'
- )
- )
- );
- }
- }
- //
- // $query->set('post_type', array(
- // 'wycieczki'
- // ));
- }
- return $query;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement