How to create a custom sticker with the epl_get_price_sticker filter
To create a custom sticker for your listing, use the filter hook 'epl_get_price_sticker'.
For example ;
To add 'New Construction' sticker on your listings, use the following code.
function my_epl_new_construction_sticker( $price_sticker ) { global $property; $property_new_construction = $property->get_property_meta('property_new_construction'); if( isset($property_new_construction) && ($property_new_construction == 1 || $property_new_construction == 'yes') ) { $price_sticker .= '<span class="status-sticker new-construction">'.__( 'New Construction' , 'easy-property-listings' ).'</span>'; } return $price_sticker ; } add_filter('epl_get_price_sticker','my_epl_new_construction_sticker');
For "New" status sticker for Commercial, Commercial Land and Business post types, to add 'New' sticker to your listings, add the following in your theme's functions.php
function my_epl_new_construction_sticker( $price_sticker ) { global $property; $date = new DateTime($property->post->post_date); $now = new DateTime(); // php > 5.3 if( method_exists($now,'diff') ) { $diff = $now->diff($date); $diff = $diff->days; } else { $diff = strtotime($now->format('M d Y ')) - strtotime($date->format('M d Y ') ) ; $diff = floor($diff/3600/24); } if ( 'commercial' == $property->post_type || 'business' == $property->post_type || 'commercial_land' == $property->post_type) { if($property->get_epl_settings('sticker_new_range') >= $diff) $price_sticker .= '<span class="status-sticker new">'.$property->get_epl_settings('label_new').'</span>'; } return $price_sticker ; } add_filter('epl_get_price_sticker','my_epl_new_construction_sticker');