| 1 |
<?php |
| 2 |
|
| 3 |
if ( ! defined( 'ABSPATH' ) ) { |
| 4 |
exit; |
| 5 |
} |
| 6 |
|
| 7 |
|
| 8 |
add_shortcode( 'avada_property_features', function( $atts ) { |
| 9 |
$atts = shortcode_atts( array( |
| 10 |
'content_align' => 'left', |
| 11 |
'fusion_font_family_features_font' => '', |
| 12 |
'fusion_font_variant_features_font' => '', |
| 13 |
'font_size' => '', |
| 14 |
'letter_spacing' => '', |
| 15 |
'text_transform' => '', |
| 16 |
'line_height' => '', |
| 17 |
'text_color' => '', |
| 18 |
'show_title' => '', |
| 19 |
), $atts ); |
| 20 |
|
| 21 |
if ( get_post_type( get_the_ID() ) != 'property' ) |
| 22 |
{ |
| 23 |
return ''; |
| 24 |
} |
| 25 |
|
| 26 |
fusion_element_rendering_elements( true ); |
| 27 |
|
| 28 |
global $property; |
| 29 |
|
| 30 |
if ( empty($property) ) |
| 31 |
{ |
| 32 |
// 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. |
| 33 |
$property = new PH_Property(get_the_ID()); |
| 34 |
} |
| 35 |
|
| 36 |
$style = Fusion_Builder_Element_Helper::get_font_styling( $atts, 'features_font' ); |
| 37 |
|
| 38 |
if ( $atts['font_size'] ) { |
| 39 |
$style .= 'font-size:' . fusion_library()->sanitize->get_value_with_unit( $atts['font_size'] ) . ';'; |
| 40 |
} |
| 41 |
|
| 42 |
if ( $atts['letter_spacing'] ) { |
| 43 |
$style .= 'letter-spacing:' . fusion_library()->sanitize->get_value_with_unit( $atts['letter_spacing'] ) . ';'; |
| 44 |
} |
| 45 |
|
| 46 |
if ( ! empty( $atts['text_transform'] ) ) { |
| 47 |
$style .= 'text-transform:' . $atts['text_transform'] . ';'; |
| 48 |
} |
| 49 |
|
| 50 |
if ( ! empty( $atts['content_align'] ) ) { |
| 51 |
$style .= 'text-align:' . $atts['content_align'] . ';'; |
| 52 |
} |
| 53 |
|
| 54 |
ob_start(); |
| 55 |
|
| 56 |
if ( $atts['show_title'] != 'yes' ) |
| 57 |
{ |
| 58 |
?> |
| 59 |
<style type="text/css"> |
| 60 |
.features h4 { display:none; } |
| 61 |
</style> |
| 62 |
<?php |
| 63 |
} |
| 64 |
|
| 65 |
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- FusionBuilder::attributes() returns the complete HTML attribute fragment and escapes each attribute name and value. |
| 66 |
echo '<div ' . FusionBuilder::attributes( 'property-features-shortcode' ) . '> |
| 67 |
<div style="' . esc_attr( safecss_filter_attr( $style ) ) . '">'; |
| 68 |
propertyhive_template_single_features(); |
| 69 |
echo ' |
| 70 |
</div> |
| 71 |
</div>'; |
| 72 |
|
| 73 |
$html = ob_get_clean(); |
| 74 |
|
| 75 |
fusion_element_rendering_elements( false ); |
| 76 |
|
| 77 |
return $html; |
| 78 |
}); |