$custom_property_items_amount, 'post_type' => 'property', 'orderby' => array( 'menu_order'=>'ASC', 'date' =>'DESC', ), 'offset' => (max(1, get_query_var('paged')) - 1) * $custom_property_items_amount, 'ignore_sticky_posts' => 1, 'post_status' => 'publish' ); if (isset($_GET['sortby']) && in_array($_GET['sortby'], array('a_price', 'd_price', 'a_date', 'd_date', 'featured', 'most_viewed'))) { if ($_GET['sortby'] == 'a_price') { $args['orderby'] = 'meta_value_num'; $args['meta_key'] = ERE_METABOX_PREFIX . 'property_price'; $args['order'] = 'ASC'; } else if ($_GET['sortby'] == 'd_price') { $args['orderby'] = 'meta_value_num'; $args['meta_key'] = ERE_METABOX_PREFIX . 'property_price'; $args['order'] = 'DESC'; } else if ($_GET['sortby'] == 'featured') { $args['orderby'] = array( 'meta_value_num' => 'DESC', 'date' => 'DESC', ); $args['meta_key'] = ERE_METABOX_PREFIX . 'property_featured'; } else if ($_GET['sortby'] == 'most_viewed') { $args['orderby'] = 'meta_value_num'; $args['meta_key'] = ERE_METABOX_PREFIX . 'property_views_count'; $args['order'] = 'DESC'; } else if ($_GET['sortby'] == 'a_date') { $args['orderby'] = 'date'; $args['order'] = 'ASC'; } else if ($_GET['sortby'] == 'd_date') { $args['orderby'] = 'date'; $args['order'] = 'DESC'; } } else{ $featured_toplist = ere_get_option('featured_toplist', 1); if($featured_toplist!=0) { $args['orderby'] = array( 'menu_order'=>'ASC', 'meta_value_num' => 'DESC', 'date' => 'DESC', ); $args['meta_key'] = ERE_METABOX_PREFIX . 'property_featured'; } } $property_status=ere_get_property_status_search(); $property_status_arr = array(); if ($property_status) { foreach ($property_status as $property_stt) { $property_status_arr[] = $property_stt->slug; } } $tax_query = array(); if (isset($_GET['status']) && in_array($_GET['status'], $property_status_arr) && $taxonomy_name != 'property-status') { $tax_query[] = array( 'taxonomy' => 'property-status', 'field' => 'slug', 'terms' => explode(',', ere_clean(wp_unslash($_GET['status']))), 'operator' => 'IN' ); } if (is_tax()) { $current_term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy')); $taxonomy_title = $current_term->name; $taxonomy_name = get_query_var('taxonomy'); if (!empty($taxonomy_name)) { $tax_query[] = array( 'taxonomy' => $taxonomy_name, 'field' => 'slug', 'terms' => $current_term->slug ); } } $tax_count = count($tax_query); if ($tax_count > 0) { $args['tax_query'] = array( 'relation' => 'AND', $tax_query ); } $author_id = $agent_id = ''; if (isset($_GET['user_id']) ||isset($_GET['agent_id']) ) { if (isset($_GET['user_id'])) { $author_id = ere_clean(wp_unslash($_GET['user_id'])); $agent_id = get_the_author_meta(ERE_METABOX_PREFIX . 'author_agent_id', $author_id); } if (isset($_GET['agent_id'])) { $agent_id = ere_clean(wp_unslash($_GET['agent_id'])); $author_id = get_post_meta($agent_id, ERE_METABOX_PREFIX . 'agent_user_id', true); } if (!empty($author_id) && $author_id > 0 && !empty($agent_id) && $agent_id > 0) { $args['meta_query'] = array( 'relation' => 'OR', array( 'key' => ERE_METABOX_PREFIX . 'property_agent', 'value' => $agent_id, 'compare' => '=' ), array( 'key' => ERE_METABOX_PREFIX . 'property_author', 'value' => $author_id, 'compare' => '=' ) ); } else { if (!empty($author_id) && $author_id > 0) { $args['author'] = $author_id; } else if (!empty($agent_id) && $agent_id > 0) { $args['meta_query'] = array( array( 'key' => ERE_METABOX_PREFIX . 'property_agent', 'value' => $agent_id, 'compare' => '=' ) ); } } } $data = new WP_Query($args); $total_post = $data->found_posts; $min_suffix = ere_get_option('enable_min_css', 0) == 1 ? '.min' : ''; wp_print_styles( ERE_PLUGIN_PREFIX . 'property'); wp_print_styles( ERE_PLUGIN_PREFIX . 'archive-property'); $min_suffix_js = ere_get_option('enable_min_js', 0) == 1 ? '.min' : ''; wp_enqueue_script(ERE_PLUGIN_PREFIX . 'archive-property', ERE_PLUGIN_URL . 'public/assets/js/property/ere-archive-property' . $min_suffix_js . '.js', array('jquery'), ERE_PLUGIN_VER, true); ?>
have_posts()) : while ($data->have_posts()): $data->the_post(); ?> $property_item_class, 'custom_property_image_size' => $custom_property_image_size )); ?>
max_num_pages; ere_get_template('global/pagination.php', array('max_num_pages' => $max_num_pages)); wp_reset_postdata(); ?>