Exemplo n.º 1
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $listing_type = isset($instance['listing_type']) ? $instance['listing_type'] : true;
        $listing_location = isset($instance['listing_location']) ? $instance['listing_location'] : true;
        $listing_id = isset($instance['listing_id']) ? $instance['listing_id'] : true;
        // Loop through standard details
        foreach (wpsight_standard_details() as $key => $values) {
            $key = isset($instance[$key]) ? $instance[$key] : true;
        }
        if (is_single() && get_post_type() == wpsight_listing_post_type()) {
            ?>
        	
        	<div id="<?php 
            echo wpsight_dashes($this->id);
            ?>
" class="listing-details section clearfix clear">
        	
        		<div class="title clearfix">
	        		
	        		<div class="title-price listing-price">
	        			<?php 
            wpsight_price();
            ?>
	        		</div>
	        		
	        		<?php 
            // Action hook listing details title inside
            do_action('wpsight_listing_details_title_inside', $args, $instance);
            ?>
						
				</div><!-- .title -->
				
				<?php 
            // Display details
            $standard_details = wpsight_standard_details();
            $listing_details = '';
            // Loop through standard details
            if (!empty($standard_details)) {
                $i = 0;
                $listing_details .= '<div class="row">' . "\n";
                foreach ($standard_details as $feature => $value) {
                    $standard_details_option = wpsight_get_option($feature);
                    // If details hasn't been set before, display default
                    if (!isset($standard_details_option['label'])) {
                        $standard_details_option = wpsight_get_option($feature, true);
                    }
                    // Don't show detail if label is emtpy in options
                    if (empty($standard_details_option['label'])) {
                        continue;
                    }
                    // Append listing ID to details
                    if ($i == 0 && $listing_id) {
                        $listing_details_id = '<div class="' . wpsight_get_span('small') . '">' . "\n";
                        $listing_details_id .= '<span class="listing-details-label">' . __('Listing ID', 'wpsight') . ':</span>' . "\n";
                        $listing_details_id .= '<span class="listing-details-value">' . wpsight_get_listing_id(get_the_ID()) . '</span><!-- .listing-id-value -->' . "\n";
                        $listing_details_id .= '</div><!-- .listing-details-id -->' . "\n";
                        $listing_details .= apply_filters('wpsight_listing_details_id', $listing_details_id, $args, $instance);
                    }
                    $listing_details_value = get_post_meta(get_the_ID(), '_' . $feature, true);
                    // Check if value is data key
                    if (!empty($value['data'])) {
                        $listing_details_value = $value['data'][$listing_details_value];
                    }
                    $listing_details_meta = get_post_meta(get_the_ID(), '_' . $feature, true);
                    if (!empty($listing_details_meta) && $instance[$feature]) {
                        $listing_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n";
                        $listing_details .= '<span class="listing-details-label">' . $value['label'] . ':</span><!-- .listing-' . $feature . '-label -->' . "\n";
                        $listing_details .= '<span class="listing-details-value">' . $listing_details_value . ' ' . wpsight_get_measurement_units($value['unit']) . '</span><!-- .listing-' . $feature . '-value -->' . "\n";
                        $listing_details .= '</div><!-- .listing-' . $feature . ' -->' . "\n";
                    }
                    $i++;
                }
                // endforeach
                // Add date - will be hidden by CSS display:none
                $listing_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n";
                $listing_details .= '<span class="listing-date updated">' . get_the_date() . '</span>' . "\n";
                $listing_details .= '</div>' . "\n";
                $listing_details .= '</div><!-- .row -->' . "\n";
            }
            // endif
            echo apply_filters('wpsight_widget_listing_details', $listing_details, $args, $instance);
            ?>
				
			</div><!-- .listing-details --><?php 
        }
    }
Exemplo n.º 2
0
    function widget($args, $instance)
    {
        extract($args, EXTR_SKIP);
        $property_type = isset($instance['property_type']) ? $instance['property_type'] : true;
        $property_location = isset($instance['property_location']) ? $instance['property_location'] : true;
        $property_id = isset($instance['property_id']) ? $instance['property_id'] : true;
        /** Loop through standard details */
        foreach (wpsight_standard_details() as $key => $values) {
            $key = isset($instance[$key]) ? $instance[$key] : true;
        }
        if (is_single() && get_post_type() == 'property') {
            ?>
        	
        	<div id="<?php 
            echo wpsight_dashes($args['widget_id']);
            ?>
" class="listing-details listing-details section clearfix clear">
        	
        		<div class="title clearfix">
	        		
	        		<div class="title-price property-price listing-price">
	        			<?php 
            wpsight_price();
            ?>
	        		</div>
	        		
	        		<?php 
            // Action hook property details title inside
            do_action('wpsight_listing_details_title_inside', $args, $instance);
            ?>
						
				</div><!-- .title -->
				
				<?php 
            // Display details
            $standard_details = wpsight_standard_details();
            $property_details = '';
            // Loop through standard details
            if (!empty($standard_details)) {
                $i = 0;
                $property_details .= '<div class="row">' . "\n";
                foreach ($standard_details as $feature => $value) {
                    // Append property ID to details
                    if ($i == 0 && $property_id) {
                        $property_details_id = '<div class="' . wpsight_get_span('small') . '">' . "\n";
                        $property_details_id .= '<span class="listing-details-label">' . __('Property ID', 'wpsight') . ':</span>' . "\n";
                        $property_details_id .= '<span class="listing-details-value">' . wpsight_get_listing_id(get_the_ID()) . '</span><!-- .listing-id-value -->' . "\n";
                        $property_details_id .= '</div><!-- .listing-details-id -->' . "\n";
                        $property_details .= apply_filters('wpsight_listing_details_id', $property_details_id);
                    }
                    $property_details_value = get_post_meta(get_the_ID(), '_' . $feature, true);
                    if (!empty($property_details_value) && $instance[$feature]) {
                        $property_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n";
                        $property_details .= '<span class="listing-details-label">' . $value['label'] . ':</span><!-- .listing-' . $feature . '-label -->' . "\n";
                        $property_details .= '<span class="listing-details-value">' . $property_details_value . ' ' . wpsight_get_measurement_units($value['unit']) . '</span><!-- .listing-' . $feature . '-value -->' . "\n";
                        $property_details .= '</div><!-- .property-' . $feature . ' -->' . "\n";
                    }
                    $i++;
                }
                // endforeach
                // Add date - will be hidden by CSS display:none
                $property_details .= '<div class="' . wpsight_get_span('small') . '">' . "\n";
                $property_details .= '<span class="listing-date updated">' . get_the_date() . '</span>' . "\n";
                $property_details .= '</div>' . "\n";
                $property_details .= '</div><!-- .row -->' . "\n";
            }
            // endif
            echo apply_filters('wpsight_widget_listing_details', $property_details);
            ?>
				
			</div><!-- .listing-details --><?php 
        }
    }