| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- /*------------------------------------------------------*/
- /* taskereasy Map
- /*------------------------------------------------------*/
- vc_map(array(
- "name" => esc_html__("Map", 'taskereasy'),
- "base" => "taskereasy_map",
- 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png',
- "class" => "",
- "description" => esc_html__("Add taskereasy map", 'taskereasy'),
- "category" => esc_html__('Taskereasy Shortcodes', 'taskereasy'),
- "params" => array(
- array(
- "type" => "textfield",
- "heading" => esc_html__("Latitude", 'taskereasy'),
- "param_name" => "latitude",
- ),
- array(
- "type" => "textfield",
- "heading" => esc_html__("Longitude", 'taskereasy'),
- "param_name" => "longitude",
- ),
- array(
- "type" => "textfield",
- "heading" => esc_html__("Zoom", 'taskereasy'),
- "param_name" => "zoom",
- ),
- array(
- 'type' => 'css_editor',
- 'heading' => esc_html__( 'CSS', 'taskereasy' ),
- 'param_name' => 'custom_design',
- 'group' => esc_html__( 'Design options', 'taskereasy' ),
- )
- )
- ));
- add_shortcode( 'taskereasy_map', function($atts, $content = null) {
- extract(shortcode_atts(array(
- 'latitude' => '',
- 'longitude' => '',
- 'zoom' => 14,
- 'custom_design' => '',
- ), $atts));
- $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' );
- $lat = !empty($latitude)?$latitude:'49.274059';
- $lon = !empty($longitude)?$longitude:'-123.1410967';
- $icon = ( !empty( taskereasy_get_config('map-icon')['url'] ) ) ? taskereasy_get_config('map-icon')['url'] : '';
- $output = '';
- $map_api = taskereasy_get_config('google-map-api');
- if($map_api != ''){
- $output .='
- <div class="office-location-map">
- <iframe src="https://www.google.com/maps/embed/v1/place?q=place_id:ChIJOwg_06VPwokRYv534QaPC8g&key='.$map_api.'" allowfullscreen></iframe>
- </div>';
- }else{
- $output.='You must add an API Key in Theme Options > Google Options first';
- }
- return $output;
- });
|