function st_vc_list_activity($attr, $content = false) { $data_vc = STActivity::get_taxonomy_and_id_term_activity(); $param = array('st_ids' => "", 'st_number' => 4, 'st_order' => '', 'st_orderby' => '', 'st_of_row' => 4, 'only_featured_location' => 'no', 'st_location' => '', 'sort_taxonomy' => ''); $param = array_merge($param, $data_vc['list_id_vc']); $data = shortcode_atts($param, $attr, 'st_list_activity'); extract($data); $page = STInput::request('paged'); if (!$page) { $page = get_query_var('paged'); } $query = array('post_type' => 'st_activity', 'posts_per_page' => $st_number, 'paged' => $page, 'order' => $st_order, 'orderby' => $st_orderby); if (!empty($st_ids)) { $query['post__in'] = explode(',', $st_ids); $query['orderby'] = 'post__in'; } if ($st_orderby == 'sale') { $query['meta_key'] = 'price'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'rate') { $query['meta_key'] = 'rate_review'; $query['orderby'] = 'meta_value'; } if ($st_orderby == 'discount') { $query['meta_key'] = 'discount'; $query['orderby'] = 'meta_value'; } $_SESSION['el_only_featured_location'] = $only_featured_location; $_SESSION['el_st_location'] = $st_location; $_SESSION['el_featured'] = array(); if ($only_featured_location == 'yes') { $STLocation = new STLocation(); $featured = $STLocation->get_featured_ids(); $_SESSION['featured'] = $featured; } $st_list_activity = new st_list_activity(); if ($only_featured_location == 'yes' || !empty($st_location)) { add_filter('posts_where', array($st_list_activity, '_get_query_where')); add_filter('posts_join', array($st_list_activity, '_get_query_join')); } if (!empty($sort_taxonomy)) { if (isset($attr["id_term_" . $sort_taxonomy])) { $id_term = $attr["id_term_" . $sort_taxonomy]; $query['tax_query'] = array(array('taxonomy' => $sort_taxonomy, 'field' => 'id', 'terms' => explode(',', $id_term))); } } query_posts($query); remove_filter('posts_where', array($st_list_activity, '_get_query_where')); remove_filter('posts_join', array($st_list_activity, '_get_query_join')); unset($_SESSION['el_only_featured_location']); unset($_SESSION['el_st_location']); unset($_SESSION['el_featured']); $r = "<div class='list_tours'>" . st()->load_template('vc-elements/st-list-activity/loop', '', $data) . "</div>"; wp_reset_query(); return $r; }