| 1 |
<?php |
| 2 |
|
| 3 |
add_shortcode( 'avada_property_price', function( $atts ) { |
| 4 |
$atts = shortcode_atts( array( |
| 5 |
'show_price_qualifier' => 'on', |
| 6 |
'content_align' => 'left', |
| 7 |
'fusion_font_family_price_font' => '', |
| 8 |
'fusion_font_variant_price_font' => '', |
| 9 |
'font_size' => '', |
| 10 |
'letter_spacing' => '', |
| 11 |
'text_transform' => '', |
| 12 |
'line_height' => '', |
| 13 |
'text_color' => '', |
| 14 |
), $atts ); |
| 15 |
|
| 16 |
if ( get_post_type( get_the_ID() ) != 'property' ) |
| 17 |
{ |
| 18 |
return ''; |
| 19 |
} |
| 20 |
|
| 21 |
fusion_element_rendering_elements( true ); |
| 22 |
|
| 23 |
global $property; |
| 24 |
|
| 25 |
if ( empty($property) ) |
| 26 |
{ |
| 27 |
$property = new PH_Property(get_the_ID()); |
| 28 |
} |
| 29 |
|
| 30 |
$style = Fusion_Builder_Element_Helper::get_font_styling( $atts, 'price_font' ); |
| 31 |
|
| 32 |
if ( $atts['font_size'] ) { |
| 33 |
$style .= 'font-size:' . fusion_library()->sanitize->get_value_with_unit( $atts['font_size'] ) . ';'; |
| 34 |
} |
| 35 |
|
| 36 |
if ( $atts['letter_spacing'] ) { |
| 37 |
$style .= 'letter-spacing:' . fusion_library()->sanitize->get_value_with_unit( $atts['letter_spacing'] ) . ';'; |
| 38 |
} |
| 39 |
|
| 40 |
if ( ! empty( $atts['text_transform'] ) ) { |
| 41 |
$style .= 'text-transform:' . $atts['text_transform'] . ';'; |
| 42 |
} |
| 43 |
|
| 44 |
if ( ! empty( $atts['content_align'] ) ) { |
| 45 |
$style .= 'text-align:' . $atts['content_align'] . ';'; |
| 46 |
} |
| 47 |
|
| 48 |
ob_start(); |
| 49 |
|
| 50 |
if ( isset($atts['show_price_qualifier']) && $atts['show_price_qualifier'] != 'on' ) |
| 51 |
{ |
| 52 |
?> |
| 53 |
<style type="text/css"> |
| 54 |
.price .price-qualifier { display:none; } |
| 55 |
</style> |
| 56 |
<?php |
| 57 |
} |
| 58 |
|
| 59 |
echo '<div ' . FusionBuilder::attributes( 'property-price-shortcode' ) . '> |
| 60 |
<div style="' . $style . '">'; |
| 61 |
propertyhive_template_single_price(); |
| 62 |
echo ' |
| 63 |
</div> |
| 64 |
</div>'; |
| 65 |
|
| 66 |
$html = ob_get_clean(); |
| 67 |
|
| 68 |
fusion_element_rendering_elements( false ); |
| 69 |
|
| 70 |
return $html; |
| 71 |
}); |