rentfetch_filter_floorplan_pricing
The rentfetch_filter_floorplan_pricing filter allows developers to customize how floorplan pricing is displayed throughout the Rent Fetch plugin. This filter runs every time floorplan pricing is retrieved and formatted, giving you complete control over the pricing output – from simple text changes to complex conditional logic based on pricing data.
Whether you want to change how unavailable pricing is displayed, modify the formatting of price ranges, add custom styling, or implement business-specific pricing rules, this filter provides the hook you need.
Parameters
apply_filters( 'rentfetch_filter_floorplan_pricing', $rent_range, $minimum_rent, $maximum_rent );
$rent_range(string|null): The formatted pricing string (e.g., “$1,200-$1,500”, “From $1,200”) ornullwhen pricing is unavailable$minimum_rent(int): Raw minimum rent value from floorplan post meta$maximum_rent(int): Raw maximum rent value from floorplan post meta
When This Filter Runs
This filter executes in the rentfetch_get_floorplan_pricing() function, which is called:
- In single floorplan templates (single-floorplans.php)
- In floorplan archive/listing displays
- When using
[rentfetch_floorplan_info info="pricing"]shortcodes - In property detail displays that include floorplan pricing
Usage Examples
Basic: Custom Unavailable Pricing Text
add_filter( 'rentfetch_filter_floorplan_pricing', 'custom_unavailable_pricing', 10, 3 );
function custom_unavailable_pricing( $rent_range, $minimum_rent, $maximum_rent ) {
// When pricing is unavailable (null), show custom message
if ( $rent_range === null ) {
return 'Call for Pricing';
}
return $rent_range;
}
Advanced: Conditional Pricing Based on Values
add_filter( 'rentfetch_filter_floorplan_pricing', 'conditional_pricing_display', 10, 3 );
function conditional_pricing_display( $rent_range, $minimum_rent, $maximum_rent ) {
// Handle unavailable pricing
if ( $rent_range === null ) {
return '<span class="pricing-unavailable">Contact Property</span>';
}
// Add special styling for luxury pricing (over $3000)
if ( $minimum_rent > 3000 ) {
return '<span class="luxury-pricing">' . $rent_range . ' (Luxury)</span>';
}
// Add "Starting at" prefix for ranges
if ( strpos( $rent_range, '-' ) !== false ) {
return 'Starting at ' . $rent_range;
}
return $rent_range;
}
Business Logic: Pricing Tiers
add_filter( 'rentfetch_filter_floorplan_pricing', 'pricing_tier_labels', 10, 3 );
function pricing_tier_labels( $rent_range, $minimum_rent, $maximum_rent ) {
if ( $rent_range === null ) {
return 'Pricing Unavailable';
}
// Add tier labels based on price ranges
if ( $minimum_rent < 1000 ) {
return $rent_range . ' <span class="tier budget">Budget</span>';
} elseif ( $minimum_rent < 2000 ) {
return $rent_range . ' <span class="tier standard">Standard</span>';
} else {
return $rent_range . ' <span class="tier premium">Premium</span>';
}
}
Important Notes
- Null Handling: When pricing data is invalid or unavailable (values under $50),
$rent_rangewill benull - Raw Data Access: Use
$minimum_rentand$maximum_rentfor conditional logic before the formatted string is created - Return Values: Always return a string for display or the original
$rent_rangeto preserve default behavior - Priority: Use priority 10 (default) for standard modifications, or higher/lower values to control execution order
- Security: When adding HTML, use appropriate escaping in your implementation
Related Filters
rentfetch_filter_property_pricing_no_price_available: Similar filter for property-level pricingrentfetch_filter_floorplan_title: Customize floorplan titlesrentfetch_get_bathroom_number_label: Customize bathroom labels
This filter provides extensive customization options for floorplan pricing display across your entire Rent Fetch implementation.