PluginProbe
Property Hive / 2.3.0
Property Hive v2.3.0
2.3.0 2.2.6 2.2.5 2.2.4 2.2.3 2.2.2 1.4.46 1.4.47 1.4.48 1.4.49 1.4.5 1.4.50 1.4.51 1.4.52 1.4.53 1.4.54 1.4.55 1.4.56 1.4.57 1.4.58 1.4.59 1.4.6 1.4.60 1.4.61 1.4.62 All 260 releases
propertyhive / includes / avada-widgets / property-map-shortcode.php

property-map-shortcode.php in Property Hive 2.3.0, at includes/avada-widgets/property-map-shortcode.php

55 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7
8 add_shortcode( 'avada_property_map', function( $atts ) {
9 $atts = shortcode_atts( array(
10 'height' => '',
11 'zoom' => '',
12 'scrollwheel' => '',
13 ), $atts );
14
15 if ( get_post_type( get_the_ID() ) != 'property' )
16 {
17 return '';
18 }
19
20 fusion_element_rendering_elements( true );
21
22 global $property;
23
24 if ( empty($property) )
25 {
26 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound -- Shared frontend property global used by the Avada shortcode contract; changing $property would break the existing property context passed to these widgets.
27 $property = new PH_Property(get_the_ID());
28 }
29
30 ob_start();
31
32 $attributes = array();
33 if ( isset($atts['height']) && $atts['height'] != '' )
34 {
35 $attributes['height'] = $atts['height'];
36 }
37 if ( isset($atts['zoom']) && isset($atts['zoom']['size']) && $atts['zoom']['size'] != '' )
38 {
39 $attributes['zoom'] = $atts['zoom']['size'];
40 }
41 if ( isset($atts['scrollwheel']) && $atts['scrollwheel'] != '' )
42 {
43 $attributes['scrollwheel'] = $atts['scrollwheel'];
44 }
45
46 $attributes = apply_filters( 'propertyhive_avada_property_map_attributes', $attributes );
47
48 get_property_map($attributes);
49
50 $html = ob_get_clean();
51
52 fusion_element_rendering_elements( false );
53
54 return $html;
55 });