Ejemplo n.º 1
0
/**
 * Load and enqueue front end scripts and stylesheets
 */
function epl_wp_enqueue_scripts()
{
    global $epl_settings;
    $epl_default_view_type = isset($epl_settings['display_archive_view_type']) ? $epl_settings['display_archive_view_type'] : 'list';
    $current_dir_path = plugins_url('', __FILE__);
    wp_register_script('epl-front-scripts', $current_dir_path . '/js/jquery-front-scripts.js', array('jquery'), EPL_PROPERTY_VER);
    if (is_epl_post() && shortcode_exists('listing_map')) {
        wp_enqueue_script('google-map-v-3', 'https://maps.googleapis.com/maps/api/js?v=3.exp');
    }
    if (isset($epl_settings['epl_use_core_css']) && $epl_settings['epl_use_core_css'] == 'on') {
    } else {
        wp_enqueue_style('epl-front-styles', $current_dir_path . '/css/style-front.css', FALSE, EPL_PROPERTY_VER);
        wp_enqueue_style('epl-css-lib', $current_dir_path . '/css/epl.css', FALSE, EPL_PROPERTY_VER);
    }
    $js_vars = array('epl_default_view_type' => $epl_default_view_type, 'ajaxurl' => admin_url('admin-ajax.php'));
    wp_enqueue_script('epl-js-lib', $current_dir_path . '/js/epl.js', array('jquery'), EPL_PROPERTY_VER);
    wp_localize_script('epl-front-scripts', 'epl_frontend_vars', $js_vars);
    wp_enqueue_script('epl-front-scripts');
}
Ejemplo n.º 2
0
function alt_inline_js_tabbed_map()
{
    global $epl_settings;
    $epl_am_single_map_height = isset($epl_settings['epl_am_single_map_height']) ? intval($epl_settings['epl_am_single_map_height']) : 400;
    $position = isset($epl_settings['epl_am_infobox_position']) ? $epl_settings['epl_am_infobox_position'] : 'top';
    $coordinates = epl_am_get_position_coordinates($position);
    $coord_left = $coordinates[0];
    $coord_top = $coordinates[1];
    if (!is_epl_post()) {
        return;
    }
    global $property;
    if ($property->get_property_meta('property_address_display') == 'yes') {
        $property_address_coordinates = $property->get_property_meta('property_address_coordinates');
    } else {
        $property_address_coordinates = '';
    }
    // if coordinates are not present than geocode address to get coordinates
    if (trim($property_address_coordinates) == '') {
        if ($property->get_property_meta('property_address_display') == 'yes') {
            $address = epl_property_get_the_full_address();
        } else {
            $address = $property->get_property_meta('property_address_suburb') . ', ';
            $address .= $property->get_property_meta('property_address_state') . ', ';
            $address .= $property->get_property_meta('property_address_postal_code');
        }
        $address = apply_filters('epl_map_address', $address);
        $address = urlencode(strtolower(trim($address)));
        $geourl = "http://maps.google.com/maps/api/geocode/json?address=" . urlencode($address) . "&sensor=false";
        $response = epl_remote_url_get($geourl);
        if (!empty($response)) {
            $geocoordinates = $response[0]->geometry->location->lat . ',' . $response[0]->geometry->location->lng;
            update_post_meta($property->post->ID, 'property_address_coordinates', $geocoordinates);
            $property_address_coordinates = $property->get_property_meta('property_address_coordinates');
        }
    }
    $title = $property->post->post_title;
    $zoom = apply_filters('epl_am_tabbed_map_zoom', 16);
    $zoom_sat = $zoom + 2;
    $content = epl_am_make_infobox();
    $map_start = isset($epl_settings['epl_am_default_map_type']) ? $epl_settings['epl_am_default_map_type'] : 'SATELLITE';
    $marker_icon = apply_filters('epl_am_marker_icon', epl_am_get_property_image($property));
    ?>
	<style>
		#map-alt { position:relative; top:0; bottom:0;height:400px; max-width:800px; width:100%; }
	</style>
	<script>
        jQuery(document).ready(function(){
	  L.mapbox.accessToken = 'pk.eyJ1IjoianNvbnd1IiwiYSI6ImNpa3YwZnpzMzAwZTN1YWtzYWcwNXg2ZzMifQ.v6YZ9axqDwZSlzbjmMOfTg';
          var latlng = <?php 
    echo '"' . $property_address_coordinates . '"';
    ?>
;
          var latlngArry = latlng.split(",");
          var lat = 0;
          var lng = 0;
          if(latlngArry.length == 2){
              var lat = parseFloat(latlngArry[0]);
              var lng = parseFloat(latlngArry[1]);
          }
	  var map = L.mapbox.map('map-alt', null, {
	      maxZoom: 18
	  }).setView([lat, lng], 16);
	
	  var layers = {
	      Satellite: L.mapbox.tileLayer('mapbox.streets-satellite'),
	      Streets: L.mapbox.tileLayer('mapbox.streets'),
	      Outdoors: L.mapbox.tileLayer('mapbox.outdoors')
	  };
	  featureLayer = L.mapbox.featureLayer({
    	      // this feature is in the GeoJSON format: see geojson.org
              // for the full specification
              type: 'Feature',
              geometry: {
                 type: 'Point',
                 // coordinates here are in longitude, latitude order because
                 // x, y is the standard for GeoJSON and many formats
                 coordinates: [
		     lng,
                     lat
                 ]
              },
              properties: {
                 title: <?php 
    echo '"' . $title . '"';
    ?>
,
                 //description: '',
                 // one can customize markers by adding simplestyle properties
                 // https://www.mapbox.com/guides/an-open-platform/#simplestyle
                 'marker-size': 'large',
                 'marker-color': '#BE9A6B',
                 'marker-symbol': 'building'
              }
          }).addTo(map);
	  layers.Satellite.addTo(map);
	  L.control.layers(layers).addTo(map);
          L.control.scale().addTo(map);
          featureLayer.on('click', function(e) {
              map.panTo(e.layer.getLatLng());
          });
        });
	</script> 

	<?php 
}
Ejemplo n.º 3
0
function epl_remove_single_thumbnail($html, $post_id, $post_thumbnail_id, $size, $attr)
{
    if (is_admin()) {
        return $html;
    }
    if (is_epl_post()) {
        // allow single listing images as well as widget images
        if (doing_action('epl_property_featured_image') || doing_action('epl_property_widgets_featured_image')) {
        } else {
            $html = '';
        }
    }
    return $html;
}
Ejemplo n.º 4
0
function cmo_breadcrumb()
{
    if (class_exists('Woocommerce') && is_woocommerce()) {
        woocommerce_breadcrumb(array('delimiter' => '', 'wrap_before' => '<ul class="cmo-breadcrumbs">', 'wrap_after' => '</ul>', 'before' => '<li>', 'after' => '</li>', 'home' => __('Home', 'cumulo')));
        return;
    }
    if (function_exists("is_bbpress") && is_bbpress()) {
        bbp_breadcrumb(array('before' => '<ul class="cmo-breadcrumbs">', 'after' => '</ul>', 'crumb_before' => '<li>', 'crumb_after' => '</li>', 'sep' => '', 'pad_sep' => 0, 'sep_before' => '', 'sep_after' => '', 'current_before' => '', 'current_after' => ''));
        return;
    }
    global $post;
    echo '<ul class="cmo-breadcrumbs">';
    if (!is_front_page()) {
        echo '<li><a href="';
        echo home_url();
        echo '">' . __('Home', 'cumulo') . "</a></li>";
        // echo '"><i class="fa fa-home"></i></a></li>';
    }
    $params['link_none'] = '';
    $separator = '';
    if (is_category() && !is_singular('cmo_portfolio')) {
        $category = get_the_category();
        $ID = $category[0]->cat_ID;
        echo is_wp_error($cat_parents = get_category_parents($ID, TRUE, '', FALSE)) ? '' : '<li>' . $cat_parents . '</li>';
    }
    if (is_singular('cmo_portfolio')) {
        echo '<li><a href="' . site_url('portfolio-items') . '">' . esc_html__('Portfolio', 'cumulo') . '</a></li>';
        echo get_the_term_list($post->ID, 'portfolio_category', '<li>', ',&nbsp;', '</li>');
        echo '<li>' . get_the_title() . '</li>';
    }
    if (function_exists("is_epl_post") && is_epl_post() && !is_epl_post_archive()) {
        echo '<li><a href="' . site_url('property') . '">' . esc_html__('Properties', 'cumulo') . '</a></li>';
    }
    if (is_singular('event')) {
        $terms = get_the_term_list($post->ID, 'event-categories', '<li>', ',&nbsp;', '</li>');
        if (!is_wp_error($terms)) {
            echo get_the_term_list($post->ID, 'event-categories', '<li>', ',&nbsp;', '</li>');
        }
        echo '<li>' . get_the_title() . '</li>';
    }
    if (is_tax()) {
        $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
        $link = get_term_link($term);
        if (is_wp_error($link)) {
            echo sprintf('<li>%s</li>', $term->name);
        } else {
            echo sprintf('<li><a href="%s" title="%s">%s</a></li>', $link, $term->name, $term->name);
        }
    }
    if (is_home()) {
        echo '<li>' . '' . '</li>';
        ///$smof_data['blog_page_title']
    }
    if (is_page() && !is_front_page()) {
        $parents = array();
        $parent_id = $post->post_parent;
        while ($parent_id) {
            $page = get_page($parent_id);
            if ($params["link_none"]) {
                $parents[] = get_the_title($page->ID);
            } else {
                $parents[] = '<li><a href="' . get_permalink($page->ID) . '" title="' . get_the_title($page->ID) . '">' . get_the_title($page->ID) . '</a></li>' . $separator;
            }
            $parent_id = $page->post_parent;
        }
        $parents = array_reverse($parents);
        echo join('', $parents);
        echo '<li>' . get_the_title() . '</li>';
    }
    if (is_single() && !is_singular('cmo_portfolio') && !is_singular('tribe_events') && !is_singular('event') && !is_singular('wpfc_sermon')) {
        $categories_1 = get_the_category($post->ID);
        if ($categories_1) {
            foreach ($categories_1 as $cat_1) {
                $cat_1_ids[] = $cat_1->term_id;
            }
            $cat_1_line = implode(',', $cat_1_ids);
        }
        if (isset($cat_1_line) && $cat_1_line) {
            $categories = get_categories(array('include' => $cat_1_line, 'orderby' => 'id'));
            if ($categories) {
                echo '<li>';
                $cats = '';
                foreach ($categories as $cat) {
                    if ($cats != '') {
                        $cats .= ', ';
                    }
                    $cats .= '<a href="' . get_category_link($cat->term_id) . '" title="' . $cat->name . '">' . $cat->name . '</a>';
                }
                echo $cats;
                echo '</li>';
            }
        }
        echo '<li>' . get_the_title() . '</li>';
    }
    if (is_tag()) {
        echo '<li>' . "Tag: " . single_tag_title('', FALSE) . '</li>';
    }
    if (is_search()) {
        echo '<li>' . __("Search", 'cumulo') . '</li>';
    }
    if (is_404()) {
        echo '<li>' . __("404 - Page Not Found", 'cumulo') . '</li>';
    }
    if (is_archive() && is_post_type_archive()) {
        $title = post_type_archive_title('', false);
        $sermon_settings = get_option('wpfc_options');
        if (is_array($sermon_settings)) {
            $title = $sermon_settings['archive_title'];
        }
        echo '<li>' . $title . '</li>';
    }
    echo "</ul>";
}