PluginProbe
Property Hive / 2.2.4
Property Hive v2.2.4
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-deposit-shortcode.php

property-deposit-shortcode.php in Property Hive 2.2.4, at includes/avada-widgets/property-deposit-shortcode.php

88 lines 2.3 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_deposit', function( $atts ) {
4 $atts = shortcode_atts( array(
5 'content_align' => 'left',
6 'fusion_font_family_deposit_font' => '',
7 'fusion_font_variant_deposit_font' => '',
8 'font_size' => '',
9 'letter_spacing' => '',
10 'text_transform' => '',
11 'line_height' => '',
12 'text_color' => '',
13 'icon' => '',
14 'before' => '',
15 'after' => '',
16 ), $atts );
17
18 if ( get_post_type( get_the_ID() ) != 'property' )
19 {
20 return '';
21 }
22
23 fusion_element_rendering_elements( true );
24
25 global $property;
26
27 if ( empty($property) )
28 {
29 $property = new PH_Property(get_the_ID());
30 }
31
32 if ( $property->department != 'residential-lettings' && ph_get_custom_department_based_on( $property->department ) != 'residential-lettings' )
33 {
34 return '';
35 }
36
37 if ( $property->get_formatted_deposit() == '' )
38 {
39 return '';
40 }
41
42 $style = Fusion_Builder_Element_Helper::get_font_styling( $atts, 'deposit_font' );
43
44 if ( $atts['font_size'] ) {
45 $style .= 'font-size:' . fusion_library()->sanitize->get_value_with_unit( $atts['font_size'] ) . ';';
46 }
47
48 if ( $atts['letter_spacing'] ) {
49 $style .= 'letter-spacing:' . fusion_library()->sanitize->get_value_with_unit( $atts['letter_spacing'] ) . ';';
50 }
51
52 if ( ! empty( $atts['text_transform'] ) ) {
53 $style .= 'text-transform:' . $atts['text_transform'] . ';';
54 }
55
56 if ( ! empty( $atts['content_align'] ) ) {
57 $style .= 'text-align:' . $atts['content_align'] . ';';
58 }
59
60 ob_start();
61
62 echo '<div ' . FusionBuilder::attributes( 'property-deposit-shortcode' ) . '>
63 <div style="' . $style . '">';
64
65 if ( ! empty($atts['icon']) )
66 {
67 echo '<span class="' . esc_attr($atts['icon']) . '"></span> ';
68 }
69
70 if ( isset($atts['before']) && !empty($atts['before']) )
71 {
72 echo $atts['before'] . ' ';
73 }
74 echo $property->get_formatted_deposit();
75 if ( isset($atts['after']) && !empty($atts['after']) )
76 {
77 echo ' ' . $atts['after'];
78 }
79 echo '
80 </div>
81 </div>';
82
83 $html = ob_get_clean();
84
85 fusion_element_rendering_elements( false );
86
87 return $html;
88 });