'', 'lat' => 45.9, 'lon' => 10.9, 'style_json' => '', 'zoom' => 15, 'height' => 400, 'scroll' => 'no', 'mask' => '', 'marker_text' => '', 'marker_content' => '', 'content_vertical' => 'top', 'content_horizontal' => 'left', 'content_width' => 300, 'google_key' => woodmart_get_opt( 'google_map_api_key' ), 'marker_icon' => '', 'css_animation' => 'none', 'el_class' => '', 'init_type' => 'page_load', 'init_offset' => '100', 'map_init_placeholder' => '', 'map_init_placeholder_size' => '', ), $atts ); extract( $parsed_atts ); $minified = woodmart_get_opt( 'minified_js' ) ? '.min' : ''; $version = woodmart_get_theme_info( 'Version' ); wp_enqueue_script( 'wd-google-map-api', 'https://maps.google.com/maps/api/js?libraries=geometry&v=3.44&key=' . $google_key, array(), $version, true ); wp_enqueue_script( 'wd-maplace', WOODMART_THEME_DIR . '/js/libs/maplace' . $minified . '.js', array( 'wd-google-map-api' ), $version, true ); woodmart_enqueue_js_script( 'google-map-element' ); $content_wrapper_classes = ''; $el_class = ''; $content_wrapper_classes .= ' wd-items-' . $content_vertical; $content_wrapper_classes .= ' wd-justify-' . $content_horizontal; $el_class .= woodmart_get_css_animation( $css_animation ); if ( $mask ) { $el_class .= ' map-mask-' . $mask; } if ( $content ) { $el_class .= ' map-container-with-content'; } if ( 'page_load' !== $init_type ) { $el_class .= ' map-lazy-loading'; } $uniqid = uniqid(); if ( $marker_icon ) { $marker_url = wp_get_attachment_image_src( $marker_icon ); $marker_icon = isset( $marker_url[0] ) ? $marker_url[0] : ''; }else{ $marker_icon = WOODMART_ASSETS_IMAGES . '/google-icon.png'; } $map_args = array( 'latitude' => $lat, 'longitude' => $lon, 'zoom' => $zoom, 'mouse_zoom' => $scroll, 'init_type' => $init_type, 'init_offset' => $init_offset, 'elementor' => false, 'json_style' => rawurldecode( woodmart_decompress( $style_json ) ), 'marker_icon' => $marker_icon, 'marker_text_needed' => $marker_text|| $title ? 'yes' : 'no', 'marker_text' => '

' . $title . '

' . esc_html( $marker_text ), 'selector' => 'wd-map-id-' . $uniqid, ); $image_id = $map_init_placeholder; $image_size = 'full'; if ( $map_init_placeholder_size ) { $image_size = $map_init_placeholder_size; } $placeholder = ''; if ( $image_id ) { $placeholder = wpb_getImageBySize( array( 'attach_id' => $image_id, 'thumb_size' => $image_size ) )['thumbnail']; } ob_start(); woodmart_enqueue_inline_style( 'map' ); ?>