<div id="content" class="content full"> <div class="container"><div class="row"><p>' . __('Vehicle might be sold or not active', 'framework') . '</p></div></div></div></div>'; } else { $save1 = isset($_SESSION['saved_vehicle_id1']) ? $_SESSION['saved_vehicle_id1'] : ''; $save2 = isset($_SESSION['saved_vehicle_id2']) ? $_SESSION['saved_vehicle_id2'] : ''; $save3 = isset($_SESSION['saved_vehicle_id3']) ? $_SESSION['saved_vehicle_id3'] : ''; $user_id = get_current_user_id(); $current_user_info_id = get_user_meta($user_id, 'imic_user_info_id', true); if ($current_user_info_id != '') { $saved_car_user = get_post_meta($current_user_info_id, 'imic_user_saved_cars', true); } if (empty($saved_car_user) || $current_user_info_id == '' || $saved_car_user == '') { $saved_car_user = array($save1, $save2, $save3); } $save_icon = imic_value_search_multi_array(get_the_ID(), $saved_car_user) ? 'fa-star' : 'fa-star-o'; $save_icon_disable = imic_value_search_multi_array(get_the_ID(), $saved_car_user) ? 'disabled' : ''; $enquiry_form1 = isset($imic_options['enquiry_form1']) ? $imic_options['enquiry_form1'] : '0'; $editor_form1 = isset($imic_options['enquiry_form1_editor']) ? $imic_options['enquiry_form1_editor'] : ''; $enquiry_form2 = isset($imic_options['enquiry_form2']) ? $imic_options['enquiry_form2'] : '0'; $editor_form2 = isset($imic_options['enquiry_form2_editor']) ? $imic_options['enquiry_form2_editor'] : ''; $enquiry_form3 = isset($imic_options['enquiry_form3']) ? $imic_options['enquiry_form3'] : '0'; $editor_form3 = isset($imic_options['enquiry_form3_editor']) ? $imic_options['enquiry_form3_editor'] : ''; $classified_data = get_option('imic_classifieds'); $classified_data = !empty($classified_data) ? $classified_data : array(); $listing_details = isset($imic_options['listing_details']) ? $imic_options['listing_details'] : 0; $specification_data_type = isset($imic_options['specification_fields_type']) ? $imic_options['specification_fields_type'] : "0"; ?> <!-- Start Body Content --> <div class="main" role="main"> <div id="content" class="content full"> <div class="container">
function imic_listing($atts, $content = null) { extract(shortcode_atts(array("title" => "", "number" => "", "column" => 4, "cats" => '', "tags" => '', "specs" => '', "view" => '0'), $atts)); $output = ''; if ($view == '0') { $layout = "list"; } elseif ($view == '1') { $layout = "grid"; } global $imic_options; $arrays = $term_array = array(); $count = 0; if ($specs != '') { $specs = explode(',', $specs); foreach ($specs as $spec) { $arrays[$count] = array('key' => 'feat_data', 'value' => $value, 'compare' => 'LIKE'); $count++; } } $arrays[$count++] = array('key' => 'imic_plugin_ad_payment_status', 'value' => '1', 'compare' => '='); $arrays[$count++] = array('key' => 'imic_plugin_listing_end_dt', 'value' => date('Y-m-d'), 'compare' => '>='); if ($cats != '') { $cats = explode(',', $cats); $term_array[0] = array('taxonomy' => 'listing-category', 'field' => 'slug', 'terms' => $cats, 'operator' => 'IN'); } if ($tags != '') { $tags = explode(',', $tags); $term_array[1] = array('taxonomy' => 'yachts-tag', 'field' => 'slug', 'terms' => $tags, 'operator' => 'IN'); } $logged_user_pin = ''; $user_id = get_current_user_id(); $logged_user = get_user_meta($user_id, 'imic_user_info_id', true); $logged_user_pin = get_post_meta($logged_user, 'imic_user_zip_code', true); if ($imic_options['badges_type'] == "0") { $badge_ids = isset($imic_options['badge_specs']) ? $imic_options['badge_specs'] : array(); } else { $badge_ids = array(); } $args_cats = array('orderby' => 'name', 'order' => 'ASC', 'fields' => 'all'); $classifieds_data = get_option('imic_classifieds'); $img_src = ''; $additional_specs = isset($imic_options['additional_specs']) ? $imic_options['additional_specs'] : ''; $additional_spec_type = get_post_meta($additional_specs, 'imic_plugin_spec_char_type', true); $additional_spec_slug = imic_the_slug($additional_specs); $additional_spec_slug = $additional_spec_type == 2 ? 'char_' . $additional_spec_slug : $additional_spec_slug; if ($imic_options['short_specifications'] == 0) { $detailed_specs = isset($imic_options['specification_list']) ? $imic_options['specification_list'] : array(); } else { $detailed_specs = array(); } $category_rail = isset($imic_options['category_rail']) ? $imic_options['category_rail'] : '0'; $browse_listing = imic_get_template_url("template-listing.php"); $additional_specs_all = get_post_meta($additional_specs, 'specifications_value', true); $highlighted_specs = isset($imic_options['highlighted_specs']) ? $imic_options['highlighted_specs'] : array(); $unique_specs = isset($imic_options['unique_specs']) ? $imic_options['unique_specs'] : ''; $args_cars = array('post_type' => 'yachts', 'tax_query' => $term_array, 'meta_query' => $arrays, 'posts_per_page' => $number, 'post_status' => 'publish'); $cars_listing = new WP_Query($args_cars); if ($cars_listing->have_posts()) { if ($view == '0' || $view == '1') { $output .= ' <div class="listing-header"> <h3>' . esc_attr($title) . '</h3> </div><div class="listing-container"> <div class="results-' . $layout . '-view">'; } else { if (isset($imic_options['enable_rtl']) && $imic_options['enable_rtl'] == 1) { $DIR = 'data-rtl="rtl"'; } else { $DIR = 'data-rtl="ltr"'; } $output .= '<section class="listing-block recent-vehicles"> <div class="listing-header"> <h3>' . esc_attr($title) . '</h3> </div> <div class="listing-container"> <div class="carousel-wrapper"> <div class="row"> <ul class="owl-carousel carousel-fw" id="vehicle-slider" data-columns="4" data-autoplay="5000" data-pagination="yes" data-arrows="no" data-single-item="no" data-items-desktop="4" data-items-desktop-small="3" data-items-tablet="2" data-items-mobile="1" ' . $DIR . '>'; } while ($cars_listing->have_posts()) { $cars_listing->the_post(); if ($view == '0' || $view == '1') { if (is_plugin_active("imi-classifieds/imi-classified.php")) { $badge_ids = imic_classified_badge_specs(get_the_ID(), $badge_ids); $detailed_specs = imic_classified_short_specs(get_the_ID(), $detailed_specs); } $saved_car_user = array(); $post_author_id = get_post_field('post_author', get_the_ID()); $user_info_id = get_user_meta($post_author_id, 'imic_user_info_id', true); $car_pin = get_post_meta($user_info_id, 'imic_user_lat_long', true); if (!empty($car_pin)) { $car_pin = explode(',', $car_pin); $lat = $car_pin[0]; $long = $car_pin[1]; } else { $lat = 0; $long = 0; } $author_role = get_option('blogname'); if (!empty($user_info_id)) { $term_list = wp_get_post_terms($user_info_id, 'user-role', array("fields" => "names")); if (!empty($term_list)) { $author_role = $term_list[0]; } else { $author_role = get_option('blogname'); } } $save1 = isset($_SESSION['saved_vehicle_id1']) ? $_SESSION['saved_vehicle_id1'] : ''; $save2 = isset($_SESSION['saved_vehicle_id2']) ? $_SESSION['saved_vehicle_id2'] : ''; $save3 = isset($_SESSION['saved_vehicle_id3']) ? $_SESSION['saved_vehicle_id3'] : ''; $specifications = get_post_meta(get_the_ID(), 'feat_data', true); $unique_value = imic_vehicle_price(get_the_ID(), $unique_specs, $specifications); $new_highlighted_specs = imic_filter_lang_specs_admin($highlighted_specs, get_the_ID()); $highlighted_specs = $new_highlighted_specs; $highlight_value = imic_vehicle_title(get_the_ID(), $highlighted_specs, $specifications); $highlight_value = $highlight_value == '' ? get_the_title() : $highlight_value; $details_value = imic_vehicle_all_specs(get_the_ID(), $detailed_specs, $specifications); $badges = imic_vehicle_all_specs(get_the_ID(), $badge_ids, $specifications); $video = get_post_meta(get_the_ID(), 'imic_plugin_video_url', true); $user_id = get_current_user_id(); $current_user_info_id = get_user_meta($user_id, 'imic_user_info_id', true); if ($current_user_info_id != '') { $saved_car_user = get_post_meta($current_user_info_id, 'imic_user_saved_cars', true); } if (empty($saved_car_user) || $current_user_info_id == '' || $saved_car_user == '') { $saved_car_user = array($save1, $save2, $save3); } $save_icon = imic_value_search_multi_array(get_the_ID(), $saved_car_user) ? 'fa-star' : 'fa-star-o'; $save_icon_disable = imic_value_search_multi_array(get_the_ID(), $saved_car_user) ? 'disabled' : ''; $output .= '<div class="result-item format-standard"> <div class="result-item-image">'; if (has_post_thumbnail()) { $output .= '<a href="' . esc_url(get_permalink()) . '" class="media-box">' . get_the_post_thumbnail(get_the_ID(), '600x400') . '</a>'; } $start = 0; $badge_position = array('vehicle-age', 'premium-listing', 'third-listing', 'fourth-listing'); if (!empty($badges)) { foreach ($badges as $badge) { $badge_class = $start == 0 ? 'default' : 'success'; $output .= '<span class="label label-' . esc_attr($badge_class) . ' ' . esc_attr($badge_position[$start]) . '">' . esc_attr($badge) . '</span>'; $start++; if ($start > 3) { break; } } } $output .= '<div class="result-item-view-buttons">'; if ($video != '') { $output .= '<a href="' . esc_attr($video) . '" data-rel="prettyPhoto"><i class="fa fa-play"></i> ' . __('View video', 'framework') . '</a>'; } $output .= '<a href="' . esc_url(get_permalink()) . '"><i class="fa fa-plus"></i> ' . __('View details', 'framework'); $output .= '</a> </div> </div> <div class="result-item-in"> <h4 class="result-item-title"><a href="' . esc_url(get_permalink()) . '">' . esc_attr($highlight_value) . '</a>'; if ($category_rail == "1" && is_plugin_active("imi-classifieds/imi-classified.php")) { $output .= imic_get_cats_list(get_the_ID(), "dropdown"); } $output .= '</h4>'; $output .= '<div class="result-item-cont"> <div class="result-item-block col1"> ' . imic_excerpt(20) . ' </div> <div class="result-item-block col2"> <div class="result-item-pricing"> <div class="price">' . esc_attr($unique_value) . '</div> </div> <div class="result-item-action-buttons"> <a ' . esc_attr($save_icon_disable) . ' href="#" rel="popup-save" class="btn btn-default btn-sm save-car"><div class="vehicle-details-access" style="display:none;"><span class="vehicle-id">' . esc_attr(get_the_ID()) . '</span></div><i class="fa ' . esc_attr($save_icon) . '"></i> ' . __('Save', 'framework') . '</a> <a href="' . esc_url(get_permalink()) . '" class="btn btn-default btn-sm">' . __('Enquire', 'framework') . '</a><br> <div class="view-distance"><div style="display:none;"><span class="car-lat">' . esc_attr($lat) . '</span><span class="car-long">' . esc_attr($long) . '</span></div><a id="' . esc_attr(get_the_ID()) . '" href="#" class="distance-calc"><i class="fa fa-map-marker"></i> ' . __('Distance from me?', 'framework') . '</a>'; $output .= '<div class="input-group"> <input type="text" value="' . esc_attr($logged_user_pin) . '" class="get-distance form-control input-sm" style="display:none;" placeholder="Enter Zipcode"> <span class="input-group-btn"> <a href="#" class="btn btn-default btn-sm search-dist" style="display:none;">' . __('Get', 'framework') . '</a> </span> </div></div> </div> </div> </div> <div class="result-item-features"> <ul class="inline">'; if (!empty($details_value)) { foreach ($details_value as $detail) { if (!empty($detail)) { $output .= '<li>' . $detail . '</li>'; } } } $output .= '</ul> </div> </div> </div>'; } else { if (is_plugin_active("imi-classifieds/imi-classified.php")) { $badge_ids = imic_classified_badge_specs(get_the_ID(), $badge_ids); $detailed_specs = imic_classified_short_specs(get_the_ID(), $detailed_specs); } $post_author_id = get_post_field('post_author', get_the_ID()); $user_info_id = get_user_meta($post_author_id, 'imic_user_info_id', true); $author_role = get_option('blogname'); if (!empty($user_info_id)) { $term_list = wp_get_post_terms($user_info_id, 'user-role', array("fields" => "names")); if (!empty($term_list)) { $author_role = $term_list[0]; } else { $author_role = get_option('blogname'); } } $specifications = get_post_meta(get_the_ID(), 'feat_data', true); $unique_value = imic_vehicle_price(get_the_ID(), $unique_specs, $specifications); $new_highlighted_specs = imic_filter_lang_specs_admin($highlighted_specs, get_the_ID()); $highlighted_specs = $new_highlighted_specs; $highlight_value = imic_vehicle_title(get_the_ID(), $highlighted_specs, $specifications); $highlight_value = $highlight_value != '' ? $highlight_value : get_the_title(get_the_ID()); $details_value = imic_vehicle_all_specs(get_the_ID(), $detailed_specs, $specifications); if (!empty($additional_specs)) { $image_key = array_search($additional_specs, $specifications['sch_title']); $additional_specs_value = $specifications['start_time'][$image_key]; $this_key = find_car_with_position($additional_specs_all, $additional_specs_value); $img_src = $additional_specs_all[$this_key]['imic_plugin_spec_image']; } $badges = imic_vehicle_all_specs(get_the_ID(), $badge_ids, $specifications); $output .= '<li class="item"> <div class="vehicle-block format-standard">'; if (has_post_thumbnail()) { $output .= '<a href="' . esc_url(get_permalink()) . '" class="media-box">' . get_the_post_thumbnail(get_the_ID()) . '</a>'; } $output .= '<div class="vehicle-block-content">'; $start = 1; $badge_position = array('vehicle-age', 'premium-listing', 'third-listing', 'fourth-listing'); foreach ($badges as $badge) { $badge_class = $start == 1 ? 'default' : 'success'; $output .= '<span class="label label-' . esc_attr($badge_class) . ' ' . esc_attr($badge_position[$start - 1]) . '">' . esc_attr($badge) . '</span>'; $start++; if ($start == 4) { break; } } if (!empty($highlight_value)) { $output .= '<h5 class="vehicle-title"><a href="' . esc_url(get_permalink()) . '">' . esc_attr($highlight_value) . '</a></h5>'; } $output .= '<span class="vehicle-meta">'; $total = 1; if (!empty($details_value)) { foreach ($details_value as $value) { $output .= esc_attr($value) . ', '; if ($total++ == 4) { break; } } } $output .= __('by', 'framework') . ' <abbr class="user-type" title="' . __('Listed by ', 'framework') . esc_attr($author_role) . '">' . esc_attr($author_role) . '</abbr></span>'; if ($img_src != '') { $speci_value = $additional_specs_all[$this_key]['imic_plugin_specification_values']; $speci_value = str_replace(' ', '%20', $speci_value); $output .= '<a href="' . esc_url(add_query_arg($additional_spec_slug, $speci_value, $browse_listing)) . '" title="' . __('View all', 'framework') . esc_attr($additional_specs_all[$this_key]['imic_plugin_specification_values']) . '" class="vehicle-body-type"><img src="' . esc_url($additional_specs_all[$this_key]['imic_plugin_spec_image']) . '" alt=""></a>'; } $output .= '<span class="vehicle-cost">' . esc_attr($unique_value) . '</span>'; if ($category_rail == "1" && is_plugin_active("imi-classifieds/imi-classified.php")) { $output .= imic_get_cats_list(get_the_ID(), "list"); } $output .= '</div> </div> </li>'; } } if ($view == '0' || $view == '1') { $output .= '</div></div>'; } else { $output .= '</ul> </div> </div> </div> </section>'; } } else { $output .= '<div class="text-align-center error-404"> <hr class="sm"> <p><strong>' . esc_attr__('Sorry - No listing found for this criteria', 'framework') . '</strong></p> <p>' . esc_attr__('Please search again with different filters.', 'framework') . '</p> </div>'; } wp_reset_postdata(); return $output; }
function imic_vehicle_all_specs($id, $specs, $this_specification) { global $imic_options; $data_type = isset($imic_options['specification_fields_type']) ? $imic_options['specification_fields_type'] : '0'; $details_value = array(); if (!empty($specs)) { $details_value = array(); foreach ($specs as $details) { $val = ''; $int_type = get_post_meta($details, 'imic_plugin_spec_char_type', true); $value_label = get_post_meta($details, 'imic_plugin_value_label', true); $label_position = get_post_meta($details, 'imic_plugin_lable_position', true); if ($int_type == "0") { if (imic_value_search_multi_array($details, $this_specification)) { $detailed_spec_key = array_search($details, $this_specification['sch_title']); $second_key = array_search($details * 111, $this_specification['sch_title']); if ($int_type == 1) { $slug = imic_the_slug($details); if ($label_position == 0) { $details_value[] = $value_label . get_post_meta($id, 'int_' . $slug, true); } else { $details_value[] = get_post_meta($id, 'int_' . $slug, true) . $value_label; } } else { if (is_int($second_key)) { $val = ' ' . $this_specification['start_time'][$second_key]; } if (is_int($detailed_spec_key)) { if ($label_position == 0) { $cur_spec = $this_specification['start_time'][$detailed_spec_key]; if ($cur_spec != '') { $spec = $cur_spec; } else { $spec = ''; } $details_value[] = $value_label . $spec . $val; } else { $details_value[] = $this_specification['start_time'][$detailed_spec_key] . $val . $value_label; } } } } } else { $specs_id_slug = imic_the_slug($details); $char_specs = get_post_meta($id, 'char_' . $specs_id_slug, true); if ($int_type == 1) { $slug = imic_the_slug($details); if ($label_position == 0) { $details_value[] = $value_label . get_post_meta($id, 'int_' . $slug, true); } else { $details_value[] = get_post_meta($id, 'int_' . $slug, true) . $value_label; } } else { if ($label_position == 0) { $details_value[] = $value_label . $char_specs; } else { $details_value[] = $char_specs . $value_label; } } } } } return $details_value; }
function imic_update_specifications_type() { global $imic_options; $specification_field_type = isset($imic_options['specification_fields_type']) ? $imic_options['specification_fields_type'] : 0; $specifications_upd_st = get_option('imic_specifications_upd_st'); if ($specifications_upd_st == '' && $specifications_upd_st != 1 && $specification_field_type == 1) { $specificiations_arg = array('post_type' => 'specification', 'posts_per_page' => -1, 'meta_query' => array(array('key' => 'imic_plugin_spec_char_type', 'value' => 0, 'compare' => '='))); $specifications_posts = new WP_Query($specificiations_arg); if ($specifications_posts->have_posts()) { while ($specifications_posts->have_posts()) { $specifications_posts->the_post(); update_post_meta(get_the_ID(), 'imic_plugin_spec_char_type', 2); } } wp_reset_postdata(); $listings_arg = array('post_type' => 'yachts', 'posts_per_page' => -1); $listing_posts = new WP_Query($listings_arg); if ($listing_posts->have_posts()) { while ($listing_posts->have_posts()) { $listing_posts->the_post(); $feat_data = get_post_meta(get_the_ID(), 'feat_data', true); if (isset($feat_data['start_time'])) { foreach ($feat_data['sch_title'] as $specs) { $this_slug = imic_the_slug($specs); if (imic_value_search_multi_array($specs, $feat_data)) { $detailed_spec_key = array_search($specs, $feat_data['sch_title']); $second_key = array_search($specs * 111, $feat_data['sch_title']); if (is_int($second_key)) { $val = $feat_data['start_time'][$second_key]; update_post_meta(get_the_ID(), 'child_' . $this_slug, $val); } if (is_int($detailed_spec_key)) { $cur_spec = $feat_data['start_time'][$detailed_spec_key]; if ($cur_spec != '') { update_post_meta(get_the_ID(), 'char_' . $this_slug, $cur_spec); } } } } } } } wp_reset_postdata(); update_option('imic_specifications_upd_st', 1); } }