rentfetch_get_bathroom_number_label
The rentfetch_get_bathroom_number_label filter allows you to customize the display format of bathroom counts throughout the Rent Fetch plugin. This filter is applied in the rentfetch_get_floorplan_bathrooms() function and affects how bathroom information appears in floorplan displays.
Usage
add_filter( 'rentfetch_get_bathroom_number_label', 'my_custom_bathroom_label', 10, 1 );
function my_custom_bathroom_label( $baths ) {
// Modify the $baths display as needed
return $baths;
}
Parameters
- $baths (int|float)
The number of bathrooms for the current floorplan.
Return
(string|null) The formatted bathroom label, or null if no bathrooms should be displayed.
Examples
Change “Bath” to “Bathroom”
<?php
add_filter( 'rentfetch_get_bathroom_number_label', 'change_bath_to_bathroom', 10, 1 );
function change_bath_to_bathroom( $baths ) {
if ( 0 === $baths ) {
return null;
} elseif ( 1 === $baths || 1.0 === $baths ) {
return '1 <span class="label bathroom-label">Bathroom</span>';
} else {
return $baths . ' <span class="label bathroom-label">Bathrooms</span>';
}
}
Use Abbreviations
<?php
add_filter( 'rentfetch_get_bathroom_number_label', 'use_bath_abbreviations', 10, 1 );
function use_bath_abbreviations( $baths ) {
if ( 0 === $baths ) {
return null;
} elseif ( 1 === $baths || 1.0 === $baths ) {
return '1 <span class="label bathroom-label">BA</span>';
} else {
return $baths . ' <span class="label bathroom-label">BAs</span>';
}
}
Custom Styling
<?php
add_filter( 'rentfetch_get_bathroom_number_label', 'custom_bath_styling', 10, 1 );
function custom_bath_styling( $baths ) {
if ( 0 === $baths ) {
return null;
} elseif ( 1 === $baths || 1.0 === $baths ) {
return '<span class="bath-count">1</span> <span class="bath-label">Full Bath</span>';
} else {
return '<span class="bath-count">' . $baths . '</span> <span class="bath-label">Full Baths</span>';
}
}
Default Output
- 0 bathrooms:
null(nothing displayed) - 1 bathroom:
1 <span class="label bathroom-label">Bath</span> - 2+ bathrooms:
{number} <span class="label bathroom-label">Baths</span>
Where It’s Used
This filter affects bathroom displays in:
- Single floorplan pages (single-floorplans.php)
- Floorplan archive grid view (floorplan-each-grid-default.php)
- Floorplan archive list view (floorplan-each-list-default.php)
- Bathroom search filters
Notes
- The filter receives the raw bathroom count as a number (int or float)
- Return
nullto hide the bathroom information entirely - The
<span class="label bathroom-label">wrapper is included for consistent styling - Changes made here will be reflected wherever
rentfetch_get_floorplan_bathrooms()is called - The filter runs within the floorplan post context, so you can access other floorplan metadata
Related Functions
rentfetch_get_floorplan_bathrooms()– The function that applies this filterrentfetch_floorplan_bathrooms()– Echoes the bathroom informationrentfetch_get_floorplan_bedrooms()– Similar function for bedroom countsrentfetch_get_square_feet_number_label()– Similar function for square footage