Example #1
0
function epl_am_make_infobox()
{
    global $property, $epl_settings;
    ob_start();
    if (has_post_thumbnail()) {
        $image = wp_get_attachment_image_src(get_post_thumbnail_id($property->post->ID), 'medium');
        $epl_am_prop_image = $image[0];
    } else {
        $epl_am_prop_image = EPL_AM_PLUGIN_URL_IMAGES . 'no-image.jpg';
    }
    ?>
	<div class="epl-adv-infobox-popup">
		<div class="epl-adv-closebtn">
		</div>
		<div class="epl-adv-popup-contents">
			<div class="epl-adv-popup-img">
				<?php 
    echo '<img
							class="property-thumb"
							src="' . $epl_am_prop_image . '"
							alt="' . get_the_title($property->post->ID) . '"
							title="' . get_the_title($property->post->ID) . '" 
						/>';
    ?>
			</div>
			<div class="epl-adv-popup-address">
				<span class="title"><?php 
    echo epl_property_get_the_full_address();
    ?>
</span>
			</div>
			<div class="epl-adv-popup-price">
				<?php 
    echo '<span class="price_class">' . epl_get_property_price() . '</span>';
    // echo '<span class="price_sticker">'.epl_get_price_sticker().'</span>';
    ?>
			</div>
			<div class="epl-adv-popup-meta">
				<?php 
    epl_property_icons();
    ?>
			</div>
			<div style="clear:both;"></div>
		</div>
	</div>
	<?php 
    $return = ob_get_clean();
    $return = trim(preg_replace('/\\s\\s+/', ' ', $return));
    return apply_filters('epl_am_infobox_content', $return);
}
/**
 * @hooked property_price
 * @hooked property_price_content
**/
function epl_property_price()
{
    echo epl_get_property_price();
}
Example #3
0
/**
 * Map Shortcode
 * @since 1.0
**/
function epl_advanced_map($atts)
{
    global $property, $post;
    if (is_null($post)) {
        return;
    }
    extract(shortcode_atts(array('post_type' => epl_all_post_types(), 'limit' => '30', 'coords' => '', 'display' => 'card', 'zoom' => '17', 'height' => '', 'cluster' => false, 'property_status' => '', 'home_open' => false, 'location' => ''), $atts));
    if (!is_array($post_type)) {
        if (!empty($post_type)) {
            $post_type = explode(",", $post_type);
        }
    }
    $args = array('post_type' => $post_type, 'posts_per_page' => $limit, 'paged' => '1', 'epl_nopaging' => 'true', 'meta_query' => array(array('key' => 'property_address_coordinates', 'value' => '', 'compare' => '!=')));
    if (!empty($property_status)) {
        if (!is_array($property_status)) {
            if (!empty($property_status)) {
                $property_status = explode(",", $property_status);
                $property_status = array_filter($property_status);
            }
        }
        if (($key = array_search('withdrawn', $property_status)) !== false) {
            unset($property_status[$key]);
        }
        if (($key = array_search('offmarket', $property_status)) !== false) {
            unset($property_status[$key]);
        }
        $args['meta_query'][] = array('key' => 'property_status', 'value' => $property_status, 'compare' => 'IN');
    }
    if (!empty($home_open)) {
        if (true == $home_open) {
            $args['meta_query'][] = array('key' => 'property_inspection_times', 'value' => '', 'compare' => '!=');
        }
    }
    // if user has specified location , use that
    if (!empty($location)) {
        if (!is_array($location)) {
            $location = explode(",", $location);
            $location = array_map('trim', $location);
            $args['tax_query'][] = array('taxonomy' => 'location', 'field' => 'slug', 'terms' => $location);
        }
    }
    // if user has not specified location fetch property's location
    if (!is_null($property)) {
        if (empty($location) && !is_archive() && !in_array($property->post_type, apply_filters('epl_am_skip_location_filter', array('epl_office')))) {
            $location = wp_get_object_terms($property->post->ID, 'location', array('fields' => 'slugs'));
            $args['tax_query'][] = array('taxonomy' => 'location', 'field' => 'slug', 'terms' => $location);
        }
    }
    $results = new Wp_Query($args);
    global $property, $epl_settings;
    $cluster = $cluster == 'true' || $cluster == 'on' ? 'true' : 'false';
    $infobox_class = isset($epl_settings['epl_am_infobox_style']) ? $epl_settings['epl_am_infobox_style'] : 'rounded';
    $return = '';
    $return .= "<div id='epl-advanced-map' class='epl-am-infobox-{$infobox_class}'>";
    $return .= '
				<input type="hidden" name="slider[zoom]" value="' . $zoom . '" />
				<input type="hidden" name="slider[height]" value="' . $height . '" />
				<input type="hidden" name="slider[cluster]" value="' . $cluster . '" />
				<input type="hidden" name="slider[display]" value="' . $display . '" />
			
				<div  class="slider-map"></div>
				<div  class="slider-map-zoom-in"></div>	
				<div  class="slider-map-zoom-out"></div>';
    if ($display == 'slider') {
        $return .= '
						<div class="slider-map-featured">
							<div class="slider-map-featured-left" ></div>
							<div  class="slider-map-featured-right"></div>
		
							<ul>';
        if ($results->have_posts()) {
            while ($results->have_posts()) {
                $results->the_post();
                if (has_post_thumbnail()) {
                    $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'medium');
                    $epl_am_prop_image = $image[0];
                } else {
                    $epl_am_prop_image = EPL_AM_PLUGIN_URL_IMAGES . 'no-image.jpg';
                }
                $return .= '
										<li id="marker_featured_' . get_the_ID() . '" class="marker-featured-slide ">
											<img src="' . $epl_am_prop_image . '" alt="' . get_the_title() . '" title="' . get_the_title() . '" />
											<span class="slider-title">' . get_the_title() . '</span>
											<p>' . get_the_excerpt() . '</p>';
                if (!in_array(get_post_type(), apply_filters('epl_am_no_price', array('location_profile')))) {
                    $return .= '
														<div class="slider-price">
															<span class="page-price">';
                    $return .= '<span class="price_class">' . epl_get_property_price() . '</span>';
                    //$return .= '<span class="price_sticker">'.epl_get_price_sticker().'</span>';
                    $return .= '
															</span>
														</div>
													';
                }
                $return .= '
											<div class="property-info">';
                //$return .= '<div class="epl-adv-popup-meta">'.epl_get_property_icons().'</div>';
                $return .= '<a href="' . get_permalink() . '" title="' . get_the_title() . '" class="view">View Property</a>
											</div>
										</li>
									';
            }
        }
        wp_reset_postdata();
        $return .= '
							</ul>
						</div>
						<div class="clear"></div>
					';
    } else {
        if ($display == 'popup') {
            $return .= '
						<div class="bpopup" id="bpopup-epl-am">
							<span class="b-close"><span>X</span></span>
							<div class="bpopup-inner" id="bpopup-inner"><!-- Ajax Loaded Data --></div>
						</div>
					';
        } else {
        }
    }
    $return .= '
			</div>

			<script type="text/javascript">
				jQuery(document).ready(function() { ';
    if ($results->have_posts()) {
        $post_counter = 1;
        while ($results->have_posts()) {
            $results->the_post();
            $property_address_coordinates = $property->get_property_meta('property_address_coordinates');
            $property_address_coordinates = explode(',', $property_address_coordinates);
            $epl_am_lat = trim($property_address_coordinates[0]);
            $epl_am_long = trim($property_address_coordinates[1]);
            if ($post_counter == 1) {
                $center_lat = $epl_am_lat;
                $center_long = $epl_am_long;
            }
            if (has_post_thumbnail()) {
                $image = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), 'medium');
                $epl_am_prop_image = $image[0];
            } else {
                $epl_am_prop_image = EPL_AM_PLUGIN_URL_IMAGES . 'no-image.jpg';
            }
            $image_pin = epl_am_get_property_image($property);
            $content = epl_get_property_icons();
            $price_content = '';
            $price_content .= '
								<div class="slider-price">
									<span class="page-price">';
            $price_content .= '<span class="price_class">' . epl_get_property_price() . '</span>';
            //$price_content .= '<span class="price_sticker">'.epl_get_price_sticker().'</span>';
            $price_content .= '
									</span>
								</div>
							';
            $content = '<div class="property-info"><span class="property_address_suburb">' . epl_property_get_the_full_address() . '</span>' . $price_content . '<div class="epl-adv-popup-meta">' . $content . '</div></div>';
            $content = preg_replace('~[\\r\\n]+~', '', $content);
            $return .= '
								myGmap.addFeaturedMarker(\'' . get_the_ID() . '\', \'' . addslashes(epl_property_get_the_full_address()) . '\', \'' . $epl_am_lat . '\', \'' . $epl_am_long . '\', \'' . $image_pin . '\', \'' . get_permalink() . '\', \'' . $epl_am_prop_image . '\', \'' . addslashes(get_the_title()) . '\', \'' . addslashes($content) . '\');
							';
            $post_counter++;
        }
    }
    wp_reset_postdata();
    if ($coords != '') {
        $center_coordinates = explode(',', $coords);
        $center_lat = trim($center_coordinates[0]);
        $center_long = trim($center_coordinates[1]);
    } else {
        if (!is_null($property)) {
            $center_coordinates = $property->get_property_meta('property_address_coordinates');
            $center_coordinates = explode(',', $center_coordinates);
            $center_lat = trim($center_coordinates[0]);
            $center_long = trim($center_coordinates[1]);
        }
    }
    $return .= '
					set_markers( "' . EPL_AM_PLUGIN_URL_IMAGES . '" );
					var latlng = new google.maps.LatLng(' . trim($center_lat) . ', ' . trim($center_long) . ');
					myGmap.gmap3("get").setCenter(latlng);
					
				});
			</script>
		';
    return $return;
}