'; $cat_id = explode(',',$cat); $org_id = explode(',',$org); $cat_filter = !empty($cat) ? array( 'taxonomy' => 'mep_cat', 'field' => 'term_id', 'terms' => $cat_id ) : ''; $org_filter = !empty($org) ? array( 'taxonomy' => 'mep_org', 'field' => 'term_id', 'terms' => $org_id ) : ''; $city_filter = !empty($city) ? array( 'key' => 'mep_city', 'value' => $city, 'compare' => 'LIKE' ) : ''; $country_filter = !empty($country) ? array( 'key' => 'mep_country', 'value' => $country, 'compare' => 'LIKE' ) : ''; $expire_filter = !empty($event_expire_on) ? array( 'key' => $event_expire_on, 'value' => $now, 'compare' => $etype ) : ''; $args = array( 'post_type' => array('mep_events'), 'paged' => $paged, 'posts_per_page' => $show, 'order' => $sort, 'orderby' => $event_order_by, // 'meta_key' => 'event_start_datetime', 'meta_key' => 'event_upcoming_datetime', 'meta_query' => array( $expire_filter, $city_filter, $country_filter ), 'tax_query' => array( $cat_filter, $org_filter ) ); $loop = new WP_Query($args); return $loop; } /** * This is the Main Function For Pagination the Event List, Just Pass the Required values It will return the Pagination with HTML */ function mep_event_pagination($total_page) { if ( get_query_var('paged') ) { $paged = get_query_var('paged'); } elseif ( get_query_var('page') ) { $paged = get_query_var('page'); } else { $paged = 1; } ?>