PluginProbe
Property Hive / 2.2.6
Property Hive v2.2.6
2.3.1 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 All 261 releases
propertyhive / includes / avada-widgets / property-address-postcode-shortcode.php

property-address-postcode-shortcode.php in Property Hive 2.2.6, at includes/avada-widgets/property-address-postcode-shortcode.php

68 lines 1.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 add_shortcode( 'avada_property_address_postcode', function( $atts ) {
4 $atts = shortcode_atts( array(
5 'content_align' => 'left',
6 'fusion_font_family_address_postcode_font' => '',
7 'fusion_font_variant_address_postcode_font' => '',
8 'font_size' => '',
9 'letter_spacing' => '',
10 'text_transform' => '',
11 'line_height' => '',
12 'text_color' => '',
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 $property = new PH_Property(get_the_ID());
27 }
28
29 if ( $property->address_postcode == '' )
30 {
31 return '';
32 }
33
34 $style = Fusion_Builder_Element_Helper::get_font_styling( $atts, 'address_postcode_font' );
35
36 if ( $atts['font_size'] ) {
37 $style .= 'font-size:' . fusion_library()->sanitize->get_value_with_unit( $atts['font_size'] ) . ';';
38 }
39
40 if ( $atts['letter_spacing'] ) {
41 $style .= 'letter-spacing:' . fusion_library()->sanitize->get_value_with_unit( $atts['letter_spacing'] ) . ';';
42 }
43
44 if ( ! empty( $atts['text_transform'] ) ) {
45 $style .= 'text-transform:' . $atts['text_transform'] . ';';
46 }
47
48 if ( ! empty( $atts['content_align'] ) ) {
49 $style .= 'text-align:' . $atts['content_align'] . ';';
50 }
51
52 ob_start();
53
54 echo '<div ' . FusionBuilder::attributes( 'property-address-postcode-shortcode' ) . '>
55 <div style="' . $style . '">';
56
57 echo esc_html($property->address_postcode);
58
59 echo '
60 </div>
61 </div>';
62
63 $html = ob_get_clean();
64
65 fusion_element_rendering_elements( false );
66
67 return $html;
68 });