function aviators_option_posts_per_agents_page($value) { if (is_post_type_archive('agent')) { return aviators_settings_get_value('agents', 'agents', 'per_page'); } return $value; }
function aviators_admin_login_head() { if (aviators_settings_get_value('admin', 'login_screen', 'default') != 'on') { echo "\n <style>\n body.login #login h1 a {\n background: url('" . get_template_directory_uri() . "/aviators/core/plugins/admin/assets/img/admin.png') no-repeat scroll center top transparent;\n height: 241px;\n\t width: auto;\n }\n </style>"; } if (aviators_settings_get_value('admin', 'login_screen', 'image')) { echo "\n <style>\n body.login #login h1 a {\n background: url('" . aviators_settings_get_value('admin', 'login_screen', 'image') . "') no-repeat scroll center top transparent;\n height: 241px;\n }\n </style>"; } }
/** * Create PayPal purchase * * @param int $post_id */ function aviators_submission_create_paypal_purchase($post_id) { aviators_submission_paypal_payment_gateway(); PayPal_Digital_Goods_Configuration::return_url(get_template_directory_uri() . '/aviators/plugins/submission/return.php?paypal=paid&post_id=' . $post_id); PayPal_Digital_Goods_Configuration::cancel_url(get_template_directory_uri() . '/aviators/plugins/submission/return.php?paypal=cancel&post_id=' . $post_id); PayPal_Digital_Goods_Configuration::notify_url(get_template_directory_uri() . '/aviators/plugins/submission/return.php?paypal=notify&post_id=' . $post_id); $post = get_post($post_id); $price = aviators_settings_get_value('submission', 'pay_per_post', 'price'); $tax = aviators_settings_get_value('submission', 'pay_per_post', 'tax'); $description = aviators_settings_get_value('submission', 'pay_per_post', 'description'); $currency = aviators_settings_get_value('submission', 'pay_per_post', 'currency_code'); $purchase_details = array('name' => get_bloginfo('name'), 'description' => get_bloginfo('description'), 'amount' => $price + $tax, 'tax_amount' => $tax, 'currency' => $currency, 'items' => array(array('item_name' => $post->post_title, 'item_description' => $description, 'item_amount' => $price, 'item_tax' => $tax, 'item_quantity' => 1, 'item_number' => $post_id))); return new PayPal_Purchase($purchase_details); }
/** * Format price */ function aviators_price_format($number) { $decimals = (int) aviators_settings_get_value('money', 'format', 'decimals'); $dec_point = aviators_settings_get_value('money', 'format', 'dec_point'); $thousands_sep = aviators_settings_get_value('money', 'format', 'thousands_sep'); $symbol = aviators_settings_get_value('money', 'currency', 'sign'); $before = (bool) aviators_settings_get_value('money', 'currency', 'before'); $number = number_format((double) $number, $decimals, $dec_point, $thousands_sep); if ($before) { return sprintf('%s %s', $symbol, $number); } else { return sprintf('%s %s', $number, $symbol); } }
public function widget($args, $instance) { global $post; extract($args); $price_from = array(); $price_from_parts = explode("\n", aviators_settings_get_value('properties', 'filter', 'from')); foreach ($price_from_parts as $price) { $price_from[] = trim($price); } $price_to = array(); $price_to_parts = explode("\n", aviators_settings_get_value('properties', 'filter', 'to')); foreach ($price_to_parts as $price) { $price_to[] = trim($price); } echo View::render('properties/filter.twig', array('id' => $this->id, 'title' => apply_filters('widget_title', $instance['title']), 'price_from' => $price_from, 'price_to' => $price_to, 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); }
public static function getInstance() { if (self::$instance !== null) { return self::$instance; } Twig_Autoloader::register(); $templates = array(); // child theme support if (get_stylesheet_directory() != get_stylesheet_directory()) { $templates[] = get_stylesheet_directory() . '/templates'; } $templates[] = get_template_directory() . '/templates'; // child theme support if (get_stylesheet_directory() != get_stylesheet_directory()) { $templates = array_merge($templates, aviators_templates_prepare_plugins_template_dirs(get_stylesheet_directory())); } $templates = array_merge($templates, aviators_templates_prepare_plugins_template_dirs(get_template_directory())); $loader = new Twig_Loader_Filesystem($templates); $instance = new Twig_Environment($loader, array('cache' => get_template_directory() . '/templates/cache', 'debug' => aviators_settings_get_value('templates', 'cache', 'debug'))); $instance->addGlobal('wp', new TwigProxy()); $instance->addGlobal('q', $_GET); $instance->addGlobal('p', $_POST); $instance->addFunction(new Twig_SimpleFunction('wp_footer', 'aviators_templates_helpers_wp_footer')); $instance->addFunction(new Twig_SimpleFunction('wp_head', 'aviators_templates_helpers_wp_head')); $instance->addFunction(new Twig_SimpleFunction('comment_form', 'aviators_templates_helpers_comment_form')); $instance->addFunction(new Twig_SimpleFunction('body_class', 'aviators_templates_body_class')); $instance->addFunction(new Twig_SimpleFunction('wp_list_comments', 'aviators_templates_helpers_wp_list_comments')); $instance->addFunction(new Twig_SimpleFunction('post_class', 'aviators_templates_helpers_post_class')); $instance->addFunction(new Twig_SimpleFunction('dynamic_sidebar', 'aviators_templates_helpers_dynamic_sidebar')); $instance->addFunction(new Twig_SimpleFunction('comments_template', 'aviators_templates_helpers_comments_template')); $instance->addFunction(new Twig_SimpleFunction('paginate_comments_links', 'aviators_templates_helpers_paginate_comments_links')); $instance->addFunction(new Twig_SimpleFunction('next_comments_link', 'aviators_templates_helpers_next_comments_link')); $instance->addFunction(new Twig_SimpleFunction('previous_comments_link', 'aviators_templates_helpers_previous_comments_link')); $instance->addFunction(new Twig_SimpleFunction('posts_nav_link', 'aviators_templates_helpers_posts_nav_link')); $instance->addFunction(new Twig_SimpleFunction('paginate_links', 'aviators_templates_helpers_paginate_links')); $instance->addFunction(new Twig_SimpleFunction('next_posts_link', 'aviators_templates_helpers_next_posts_link')); $instance->addFunction(new Twig_SimpleFunction('previous_posts_link', 'aviators_templates_helpers_previous_posts_link')); $instance->addFunction(new Twig_SimpleFunction('kk_star_ratings', 'aviators_templates_helpers_kk_star_ratings')); $instance->addExtension(new HTMLDecodeTwigExtension()); return $instance; }
/** * Add new post * * @return string */ function aviators_submission_render_add() { if (!is_user_logged_in()) { aviators_flash_add_message(AVIATORS_FLASH_ERROR, __('You must be logged in to access this page.', 'aviators')); return wp_redirect(home_url()); } $type = aviators_settings_get_value('submission', 'common', 'post_type'); if (empty($type)) { aviators_flash_add_message(AVIATORS_FLASH_ERROR, __('There are no defined custom post types for submission system.', 'aviators')); return wp_redirect(home_url()); } $form = call_user_func('aviators_' . $type . '_form'); $tos = aviators_settings_get_value('submission', 'tos', 'enable_tos'); if ($tos) { $tos_content = __('No Legal Agreement selected!', 'aviators'); if ($tos_id = aviators_settings_get_value('submission', 'tos', 'tos_page')) { $tos_page = get_post($tos_id); $tos_content = do_shortcode($tos_page->post_content); } } return View::render('submission/add.twig', array('form' => $form, 'tos' => $tos, 'tos_page' => $tos_page, 'tos_content' => $tos_content)); }
public function widget($args, $instance) { global $post; extract($args); $posts = array(); $parts = explode(',', $instance['properties']); foreach ($parts as $part) { $posts[] = trim($part); } $args = array('post__in' => $posts, 'post_type' => 'property', 'posts_per_page' => -1); $price_from = array(); $price_from_parts = explode("\n", aviators_settings_get_value('properties', 'filter', 'from')); foreach ($price_from_parts as $price) { $price_from[] = trim($price); } $price_to = array(); $price_to_parts = explode("\n", aviators_settings_get_value('properties', 'filter', 'to')); foreach ($price_to_parts as $price) { $price_to[] = trim($price); } echo View::render('properties/slider-large.twig', array('id' => $this->id, 'properties' => _aviators_properties_prepare(new WP_Query($args)), 'price_to' => $price_to, 'price_from' => $price_from, 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); }
function aviators_properties_filter($return_query = FALSE, $use_pager = TRUE) { $paged = get_query_var('paged') ? get_query_var('paged') : 1; $wp_query = new WP_Query(); $properties = array('post_type' => 'property', 'posts_per_page' => -1, 'tax_query' => array(), 'meta_query' => array(), 'order_by' => 'published'); if ($use_pager) { $properties['posts_per_page'] = aviators_settings_get_value('properties', 'properties', 'per_page'); $properties['paged'] = $paged; } if (!empty($_GET['filter_order'])) { $properties['order'] = $_GET['filter_order']; } else { $properties['order'] = 'DESC'; } $default_sort = aviators_settings_get_value('properties', 'properties', 'default_sort'); if (isset($_GET['filter_sort_by'])) { $default_sort = $_GET['filter_sort_by']; } switch ($default_sort) { case 'price': $properties['orderby'] = 'meta_value_num'; $properties['meta_key'] = '_property_price'; break; case 'beds': $properties['orderby'] = 'meta_value_num'; $properties['meta_key'] = '_property_bedrooms'; break; case 'baths': $properties['orderby'] = 'meta_value_num'; $properties['meta_key'] = '_property_bathrooms'; break; case 'date': $properties['orderby'] = 'date'; break; default: $properties['orderby'] = 'title'; } if (!empty($_GET['filter_location'])) { $properties['tax_query'][] = array('taxonomy' => 'locations', 'field' => 'id', 'terms' => $_GET['filter_location'], 'operator' => 'IN'); } if (!empty($_GET['filter_sublocation'])) { $properties['tax_query'][] = array('taxonomy' => 'locations', 'field' => 'id', 'terms' => $_GET['filter_sublocation'], 'operator' => 'IN'); } if (!empty($_GET['filter_sub_sublocation'])) { $properties['tax_query'][] = array('taxonomy' => 'locations', 'field' => 'id', 'terms' => $_GET['filter_sub_sublocation'], 'operator' => 'IN'); } if (!empty($_GET['filter_property_id'])) { if (strlen($_GET['filter_property_id']) >= 2) { $properties['meta_query'][] = array('key' => '_property_id', 'value' => $_GET['filter_property_id'], 'compare' => 'LIKE'); } } if (!empty($_GET['filter_type'])) { if (is_array($_GET['filter_type']) && count($_GET['filter_type']) > 0) { $terms = array(); foreach ($_GET['filter_type'] as $type) { $terms[] = $type; } $properties['tax_query'][] = array('taxonomy' => 'property_types', 'field' => 'id', 'terms' => $terms, 'operator' => 'IN'); } else { $properties['tax_query'][] = array('taxonomy' => 'property_types', 'field' => 'id', 'terms' => $_GET['filter_type'], 'operator' => 'IN'); } } if (!empty($_GET['filter_bedrooms'])) { $properties['meta_query'][] = array('key' => '_property_bedrooms', 'value' => $_GET['filter_bedrooms'], 'compare' => '>=', 'type' => 'numeric'); } if (!empty($_GET['filter_bathrooms'])) { $properties['meta_query'][] = array('key' => '_property_bathrooms', 'value' => $_GET['filter_bathrooms'], 'compare' => '>=', 'type' => 'numeric'); } if (!empty($_GET['filter_contract_type'])) { $properties['tax_query'][] = array('taxonomy' => 'property_contracts', 'field' => 'id', 'terms' => $_GET['filter_contract_type'], 'operator' => 'IN'); } // Area if (!empty($_GET['filter_area_from']) && !empty($_GET['filter_area_to'])) { $properties['meta_query'][] = array('key' => '_property_area', 'value' => array($_GET['filter_area_from'], $_GET['filter_area_to']), 'type' => 'numeric', 'compare' => 'BETWEEN'); } elseif (!empty($_GET['filter_area_from'])) { $properties['meta_query'][] = array('key' => '_property_area', 'value' => $_GET['filter_area_from'], 'type' => 'numeric', 'compare' => '>='); } elseif (!empty($_GET['filter_area_to'])) { $properties['meta_query'][] = array('key' => '_property_area', 'value' => $_GET['filter_area_to'], 'type' => 'numeric', 'compare' => '<='); } // Price if (!empty($_GET['filter_price_from']) && !empty($_GET['filter_price_to'])) { $properties['meta_query'][] = array('key' => '_property_price', 'value' => array($_GET['filter_price_from'], $_GET['filter_price_to']), 'type' => 'numeric', 'compare' => 'BETWEEN'); } elseif (!empty($_GET['filter_price_from'])) { $properties['meta_query'][] = array('key' => '_property_price', 'value' => $_GET['filter_price_from'], 'type' => 'numeric', 'compare' => '>='); } elseif (!empty($_GET['filter_price_to'])) { $properties['meta_query'][] = array('key' => '_property_price', 'value' => $_GET['filter_price_to'], 'type' => 'numeric', 'compare' => '<='); } $wp_query->query($properties); if ($return_query) { return $wp_query; } return _aviators_properties_prepare($wp_query); }
<?php /** * Template Name: Properties Grid Template */ global $wp_query; $rows = aviators_settings_get_value('properties', 'homepage', 'rows'); $cols = aviators_settings_get_value('properties', 'homepage', 'cols'); $type = aviators_settings_get_value('properties', 'homepage', 'type'); $shuffle = aviators_settings_get_value('properties', 'homepage', 'shuffle_results'); $do_shuffle = FALSE; if ($shuffle == 'on') { $do_shuffle = TRUE; } switch ($type) { case 'reduced': $posts = aviators_properties_get_reduced($rows * $cols, $do_shuffle); break; case 'featured': $posts = aviators_properties_get_featured($rows * $cols, $do_shuffle); break; default: $posts = aviators_properties_get_most_recent($rows * $cols, $do_shuffle); break; } $id = get_the_ID(); $post = get_post($id); $content = do_shortcode($post->post_content); echo View::render('page-properties-grid.twig', array('wp_query' => $wp_query, 'page' => $post, 'content' => $content, 'posts' => $posts));
// send to agents if (aviators_settings_get_value('properties', 'enquire_form_receive', 'agent') && is_array($agents)) { foreach ($agents as $agent_id) { $email = get_post_meta($agent_id, '_agent_email', TRUE); $is_sent = wp_mail($email, aviators_settings_get_value('properties', 'enquire_form', 'subject'), $message, $headers); } } // send to admin if (aviators_settings_get_value('properties', 'enquire_form_receive', 'admin')) { $is_sent = wp_mail(get_option('admin_email'), aviators_settings_get_value('properties', 'enquire_form', 'subject'), $message, $headers); } // send to custom address $send_to_custom = aviators_settings_get_value('properties', 'enquire_form_receive', 'custom'); if (!empty($send_to_custom)) { $emails = explode(',', $send_to_custom); foreach ($emails as $email) { $is_sent = wp_mail(trim($email), aviators_settings_get_value('properties', 'enquire_form', 'subject'), $message, $headers); } } if ($is_sent) { aviators_flash_add_message(AVIATORS_FLASH_SUCCESS, __('Your enquire was successfully sent.', 'aviators')); } else { aviators_flash_add_message(AVIATORS_FLASH_ERROR, __('An error occured. Your enquire can not be sent.', 'aviators')); } } if (!empty($_SERVER['HTTP_REFERER'])) { header('Location: ' . $_SERVER['HTTP_REFERER']); } else { header('Location: ' . site_url()); } }
<?php global $wp_query; $wp_query = new WP_Query(array('post_type' => 'agent', 'orderby' => 'menu_order', 'order' => 'ASC', 'posts_per_page' => aviators_settings_get_value('agents', 'agents', 'per_page'), 'paged' => get_query_var('paged'))); echo View::render('archive-agent.twig', array('wp_query' => $wp_query, 'posts' => $wp_query->posts));
<?php global $wp_query; $default_sort = aviators_settings_get_value('properties', 'properties', 'default_sort'); if (isset($_GET['filter_sort_by'])) { $default_sort = $_GET['filter_sort_by']; } echo View::render('archive-property.twig', array('wp_query' => aviators_properties_filter(TRUE), 'properties' => aviators_properties_filter(FALSE), 'default_sort' => $default_sort));
function aviators_properties_property_edit($id = NULL, $values) { $metabox = aviators_property_get_metabox(); $payment_gateway = aviators_settings_get_value('submission', 'common', 'payment_gateway'); if ($id) { $post = (array) get_post($id); } else { $post = array(); } $post['post_type'] = 'property'; $post['post_title'] = $values['post_title']; $post['post_content'] = $values['content']; $bool = aviators_settings_get_value('properties', 'common', 'frontend_needs_submission'); $gateway = aviators_settings_get_value('submission', 'common', 'payment_gateway'); // Only if creating // it should go to pending approval if set so if ($gateway == 'paypal') { if ($id) { // if not paid, post status has always be set to draft // otherwise we leave it as it is if (!aviators_properties_submission_is_paid(get_current_user_id(), $id)) { $post['post_status'] = 'draft'; } } } else { // free submission might require review if ($bool == 'on') { $post['post_status'] = 'pending'; } else { $post['post_status'] = 'draft'; } } // If already existing // Don't change the status // save if ($id) { wp_update_post($post); aviators_flash_add_message(AVIATORS_FLASH_SUCCESS, __('Post has been successfully updated.', 'aviators')); } else { $id = wp_insert_post($post); aviators_flash_add_message(AVIATORS_FLASH_SUCCESS, __('Post has been successfully created.', 'aviators')); } // set post terms $locations = array($values['property_locations']); if (isset($values['property_sublocations'])) { $locations[] = $values['property_sublocations']; } if (isset($values['property_subsublocations'])) { $locations[] = $values['property_subsublocations']; } wp_set_post_terms($id, $values['property_types'], 'property_types'); wp_set_post_terms($id, $locations, 'locations'); wp_set_post_terms($id, $values['property_contracts'], 'property_contracts'); if (isset($values['tax_input']) && is_array($values['tax_input']) && is_array($values['tax_input']['amenities'])) { $tags = ''; foreach ($values['tax_input']['amenities'] as $amenity) { $tags .= $amenity . ','; } wp_set_post_terms($id, $tags, 'amenities'); } // save meta $metabox->force_save($id); // get submission index $pages = get_posts(array('post_type' => 'page', 'meta_key' => '_wp_page_template', 'meta_value' => 'page-submission-index.php')); $submission_page = $pages[0]; // featured image was error if (!empty($_FILES['featured_image']['name']) && $_FILES['featured_image']['error'] !== UPLOAD_ERR_OK) { if (!empty($_FILES['featured_image'])) { aviators_flash_add_message(AVIATORS_FLASH_ERROR, __('Image can not be uploaded', 'aviators')); wp_redirect(get_permalink($submission_page->ID)); return TRUE; } } else { if (!empty($_FILES['featured_image']['name'])) { $thumbnail_id = get_post_thumbnail_id($id); if ($thumbnail_id) { update_post_meta($id, '_thumbnail_id', ''); } require_once ABSPATH . 'wp-admin/includes/image.php'; require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/media.php'; $attach_id = media_handle_upload('featured_image', $id); update_post_meta($id, '_thumbnail_id', $attach_id); } } $slides = get_post_meta($id, '_property_slides'); $slides = reset($slides); // parse out remaining / already existing slides $existing_slides = array(); foreach ($values as $key => $field) { if (!is_array($field)) { if (strpos($key, '_property_meta_slides_id_') !== FALSE) { $slide_id = filter_var($key, FILTER_SANITIZE_NUMBER_INT); if (isset($values['_property_meta_slides_weight_' . $slide_id])) { $existing_slides[$values['_property_meta_slides_weight_' . $slide_id]] = $field; } } } } $new_slides = array(); // remove old slides if (is_array($existing_slides) && count($existing_slides)) { foreach ($slides as $slide) { $bool = TRUE; foreach ($existing_slides as $weight => $existing_slide) { if ($slide['imgurl'] == $existing_slide) { // we are preserving this $bool = FALSE; $new_slides[$weight] = $slide; break; } } if ($bool) { global $wpdb; // @TODO - HERE IS RESIZE - remove it ? $guid = $slide['imgurl']; // str_replace('-150x150', '', $slide['imgurl']); // select according to guid $result = $wpdb->get_row($wpdb->prepare("SELECT ID FROM {$wpdb->posts} WHERE guid = \"{$guid}\"")); // delete old slide if ($result->id) { wp_delete_attachment($result->id); } } } } foreach ($_FILES as $key => $file) { if (strpos($key, '_property_meta_slides') !== FALSE) { if (!empty($_FILES[$key]['name']) && $_FILES[$key]['error'] !== UPLOAD_ERR_OK) { aviators_flash_add_message(AVIATORS_FLASH_SUCCESS, __('Image can not be uploaded', 'aviators')); wp_redirect(get_permalink($submission_page->ID)); return TRUE; } else { require_once ABSPATH . 'wp-admin/includes/image.php'; require_once ABSPATH . 'wp-admin/includes/file.php'; require_once ABSPATH . 'wp-admin/includes/media.php'; $attach_id = media_handle_upload($key, $id); $weight = filter_var($key, FILTER_SANITIZE_NUMBER_INT); if (isset($values['_property_meta_slides_weight_' . $weight])) { $result = wp_get_attachment_image_src($attach_id); $new_slides[$values['_property_meta_slides_weight_' . $weight]]['imgurl'] = $result[0]; } } } } $results = get_post_meta($id); if (is_array($results['_property_meta_fields'])) { $meta_fields = $results['_property_meta_fields']; } else { $meta_fields = unserialize($results['_property_meta_fields']); } $meta_fields[] = '_property_slides'; ksort($new_slides); update_post_meta($id, '_property_meta_fields', array('_property_id', '_property_title', '_property_landlord', '_property_agencies', '_property_agents', '_property_custom_text', '_property_price', '_property_price_suffix', '_property_bathrooms', '_property_hide_baths', '_property_hide_beds', '_property_area', '_property_latitude', '_property_longitude', '_property_featured', '_property_reduced', '_property_slider_image', '_property_slides')); update_post_meta($id, '_property_slides', $new_slides); wp_redirect(get_permalink($submission_page->ID)); return TRUE; }
<?php require_once '../../../../../../wp-load.php'; $post = get_post($_GET['post_id']); $post->post_status = 'publish'; switch ($_GET['paypal']) { case 'paid': wp_update_post($post); $transaction_id = wp_insert_post(array('post_title' => 'Transaction ' . mysql2date(get_option('date_format'), date("Y-m-d H:i:s")), 'post_type' => 'transaction', 'post_status' => 'publish')); global $current_user; $purchase = aviators_submission_create_paypal_purchase($_GET['post_id']); $purchase->process_payment(); $price = aviators_settings_get_value('submission', 'pay_per_post', 'price') + aviators_settings_get_value('submission', 'pay_per_post', 'tax'); $formatted_price = aviators_price_format($price); update_post_meta($transaction_id, '_transaction_user_id', $current_user->ID); update_post_meta($transaction_id, '_transaction_cost', $formatted_price); update_post_meta($transaction_id, '_transaction_status', $_GET['paypal']); update_post_meta($transaction_id, '_transaction_post_id', $_GET['post_id']); update_post_meta($transaction_id, '_transaction_token', $_GET['token']); update_post_meta($transaction_id, '_transaction_payer_id', $_GET['PayerID']); update_post_meta($transaction_id, '_transaction_meta_fields', array('_transaction_user_id', '_transaction_cost', '_transaction_status', '_transaction_post_id', '_transaction_token', '_transaction_payer_id')); aviators_flash_add_message(AVIATORS_FLASH_SUCCESS, __('Submission has been successfully published. Thanks!', 'aviators')); return wp_redirect(home_url()); break; default: aviators_flash_add_message(AVIATORS_FLASH_ERROR, __('Submission has not been paid yet.', 'aviators')); return wp_redirect(home_url()); break; }
public function widget($args, $instance) { extract($args); $price_from = array(); $price_from_parts = explode("\n", aviators_settings_get_value('properties', 'filter', 'from')); foreach ($price_from_parts as $price) { $price_from[] = trim($price); } $price_to = array(); $price_to_parts = explode("\n", aviators_settings_get_value('properties', 'filter', 'to')); foreach ($price_to_parts as $price) { $price_to[] = trim($price); } echo View::render('properties/map.twig', array('latitude' => $instance['latitude'], 'longitude' => $instance['longitude'], 'zoom' => $instance['zoom'], 'height' => $instance['height'], 'properties' => aviators_properties_get_for_map(), 'price_from' => $price_from, 'price_to' => $price_to, 'show_filter' => $instance['show_filter'], 'horizontal_filter' => !empty($instance['horizontal_filter']) ? TRUE : FALSE, 'map_filtering' => !empty($instance['map_filtering']) ? TRUE : FALSE, 'enable_geolocation' => !empty($instance['enable_geolocation']) ? TRUE : FALSE, 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); }
" value="<?php echo $value; ?> " placeholder="<?php echo __('Latitude', 'aviators'); ?> "/> <?php $mb->the_field('longitude'); ?> <?php $value = get_post_meta($post->ID, '_property_longitude', true); ?> <?php $value = !empty($value) ? $value : aviators_settings_get_value('properties', 'map', 'longitude'); ?> <label><?php echo __('Longitude', 'aviators'); ?> </label> <input id="latitude-selector" class="longitude" type="text" name="<?php $mb->the_name(); ?> " value="<?php echo $value; ?> " placeholder="<?php echo __('Longitude', 'aviators'); ?> "/>
<?php if (aviators_settings_get_value('properties', 'common', 'show_only_checked')) { $amenities = wp_get_post_terms($post->ID, 'amenities'); } else { $amenities = get_terms('amenities', array('hide_empty' => FALSE)); } $amenities_count = count($amenities); $amenities_per_column = $amenities_count / 4; $amenities_columized = array(); foreach ($amenities as $key => $value) { $index = intval($key / $amenities_per_column); $amenities_columized[$index][] = $value; } echo View::render('single-property.twig', array('post' => $post, 'amenities' => $amenities_columized));