コード例 #1
0
 public function widget($args, $instance)
 {
     extract($args);
     $do_shuffle = FALSE;
     if (!empty($instance['shuffle']) && $instance['shuffle']) {
         $do_shuffle = TRUE;
     }
     echo View::render('properties/widget-large.twig', array('title' => apply_filters('widget_title', $instance['title']), 'properties' => aviators_properties_get_featured(3, $do_shuffle), 'before_widget' => $before_widget, 'after_widget' => $after_widget, 'before_title' => $before_title, 'after_title' => $after_title));
 }
コード例 #2
0
 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));
 }
コード例 #3
0
<?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));