function aviators_properties_get_for_map() { $filtered_properties = array(); $properties = aviators_properties_get_most_recent(9999); $properties_gps = array(); foreach ($properties as $property) { if (!empty($property->_property_latitude) && !empty($property->_property_latitude)) { if (!in_array($property->_property_latitude . $property->_property_latitude, $properties_gps)) { $properties_gps[] = $property->_property_latitude . $property->_property_latitude; if (is_numeric($property->_property_latitude) && is_numeric($property->_property_longitude)) { $filtered_properties[] = $property; } } } } return $filtered_properties; }
public function widget($args, $instance) { extract($args); $instance['count'] = !empty($instance['count']) ? $instance['count'] : 3; $instance['type'] = !empty($instance['type']) ? $instance['type'] : 'new'; switch ($instance['type']) { case 'featured': $properties = aviators_properties_get_featured($instance['featured']); break; case 'reduced': $properties = aviators_properties_get_reduced($instance['count']); break; case 'new': $properties = aviators_properties_get_most_recent($instance['count']); break; case 'random': $properties = aviators_properties_get_most_recent($instance['count'], TRUE); break; default: $properties = aviators_properties_get_most_recent($instance['count']); break; } echo View::render('properties/carousel.twig', array('title' => apply_filters('widget_title', $instance['title']), 'properties' => $properties, 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); }
<?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));
public function widget($args, $instance) { extract($args); $do_shuffle = FALSE; if (!empty($instance['shuffle']) && $instance['shuffle']) { $do_shuffle = TRUE; } echo View::render('properties/widget.twig', array('title' => apply_filters('widget_title', $instance['title']), 'count' => $instance['count'], 'properties' => aviators_properties_get_most_recent($instance['count'], $do_shuffle), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title)); }