function st_vc_list_holiday($attr, $content = false) { $data_vc = STHoliday::get_taxonomy_and_id_term_holiday(); $param = array('st_ids' => '', 'st_number_holiday' => 4, 'st_order' => '', 'st_orderby' => '', 'st_holiday_of_row' => '', 'st_style' => 'style_1', 'only_featured_location' => 'no', 'st_location' => '', 'sort_taxonomy' => '', 'title' => '', 'font_size' => '3'); $param = array_merge($param, $data_vc['list_id_vc']); $data = shortcode_atts($param, $attr, 'st_list_holiday'); extract($data); $page = STInput::request('paged'); if (!$page) { $page = get_query_var('paged'); } $query = array('post_type' => 'st_holidays', 'posts_per_page' => $st_number_holiday, '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'; } if ($st_orderby == 'last_minute_deal') { $query['order'] = 'DESC'; $query['orderby'] = 'meta_value'; $query['meta_key'] = 'sale_price_from'; $query['meta_query'][] = array('key' => 'is_sale_schedule', 'value' => 'on', 'compare' => "="); } 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))); } } $_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['el_featured'] = $featured; } $st_list_holiday = new st_list_holiday(); if ($only_featured_location == 'yes' || !empty($st_location)) { add_filter('posts_where', array($st_list_holiday, '_get_query_where')); add_filter('posts_join', array($st_list_holiday, '_get_query_join')); } query_posts($query); remove_filter('posts_where', array($st_list_holiday, '_get_query_where')); remove_filter('posts_join', array($st_list_holiday, '_get_query_join')); unset($_SESSION['el_only_featured_location']); unset($_SESSION['el_st_location']); unset($_SESSION['el_featured']); if ($st_style == 'style_1') { $r = "<div class='list_holidays'>" . st()->load_template('vc-elements/st-list-holiday/loop', '', $data) . "</div>"; } if ($st_style == 'style_2') { $r = "<div class='list_holidays'>" . st()->load_template('vc-elements/st-list-holiday/loop2', '', $data) . "</div>"; } if ($st_style == 'style_3') { $r = "<div class='list_holidays'>" . st()->load_template('vc-elements/st-list-holiday/loop3', '', $data) . "</div>"; } if ($st_style == 'style_4') { $r = "<div class='list_holidays'>" . st()->load_template('vc-elements/st-list-holiday/loop4', '', $data) . "</div>"; } wp_reset_query(); if (!empty($title) and !empty($r)) { $r = '<h' . $font_size . '>' . $title . '</h' . $font_size . '>' . $r; } return $r; }