Ejemplo n.º 1
0
 function aesop_timeline_class_loader()
 {
     global $post;
     $default_location = is_single();
     $location = apply_filters('aesop_timeline_component_appears', $default_location);
     if (function_exists('aesop_component_exists') && aesop_component_exists('timeline_stop') && $location) {
         new AesopTimelineComponent();
     }
 }
 /**
  *
  *	Optional add js or css
  */
 function scripts()
 {
     // this handy function checks a post or page to see if your component exists beore enqueueing assets
     if (function_exists('aesop_component_exists') && aesop_component_exists('timeline')) {
         wp_enqueue_style('timeline-style', ASE_TIMELINE_URL . '/dist/css/style.css', ASE_TIMELINE_VERSION);
         // use dashicons on the front end
         // http://jespervanengelen.com/snippets/use-wordpress-dashicons-frontend/
         wp_enqueue_style('dashicons');
     }
 }
Ejemplo n.º 3
0
    public function aesop_map_loader()
    {
        global $post;
        $id = isset($post) ? $post->ID : null;
        $markers = isset($post) ? get_post_meta($id, 'ase_map_component_locations', false) : false;
        $start = isset($post) && self::get_map_meta($id, 'ase_map_component_start') ? self::get_map_meta($id, 'ase_map_component_start') : self::start_fallback($markers);
        $zoom = isset($post) && self::get_map_meta($id, 'ase_map_component_zoom') ? self::get_map_meta($id, 'ase_map_component_zoom') : 12;
        $default_location = is_single();
        $location = apply_filters('aesop_map_component_appears', $default_location);
        $tiles = isset($post) ? aesop_map_tile_provider($post->ID) : false;
        if (function_exists('aesop_component_exists') && aesop_component_exists('map') && $location) {
            ?>
			<!-- Aesop Locations -->
			<script>

				<?php 
            if ($markers) {
                ?>

					var map = L.map('aesop-map-component',{
						scrollWheelZoom: false,
						zoom: <?php 
                echo wp_filter_nohtml_kses(round($zoom));
                ?>
,
						center: [<?php 
                echo $start;
                ?>
]
					});

					L.tileLayer('<?php 
                echo $tiles;
                ?>
', {
						maxZoom: 20
					}).addTo(map);

					<?php 
                foreach ($markers as $marker) {
                    $lat = $marker['lat'];
                    $long = $marker['lng'];
                    $text = $marker['title'] ? $marker['title'] : null;
                    $loc = sprintf('%s,%s', esc_attr($lat), esc_attr($long));
                    // if market content is set run a popup
                    if ($text) {
                        ?>

							L.marker([<?php 
                        echo $loc;
                        ?>
]).addTo(map).bindPopup('<?php 
                        echo aesop_component_media_filter($text);
                        ?>
').openPopup();

						<?php 
                    } else {
                        ?>

							L.marker([<?php 
                        echo $loc;
                        ?>
]).addTo(map);

						<?php 
                    }
                }
            } else {
                if (is_user_logged_in()) {
                    $url = admin_url('post.php?post=' . $id . '&action=edit');
                    $editlink = sprintf('<a href="%s">here</a>', $url);
                    ?>
jQuery('#aesop-map-component').append('<div class="aesop-error aesop-content"><?php 
                    echo __("Your map appears to be empty! Setup and configure your map markers in this post {$editlink}.", 'aesop-core');
                    ?>
</div>');<?php 
                }
            }
            ?>
			</script>

		<?php 
        }
        //end if
    }