Single-floorplans.php
The single-floorplans.php template handles the display of individual floor plan pages in Rent Fetch. This template is highly customizable, allowing themes to override the entire layout or individual components.
Template Structure
The template follows a modular structure with the following main sections:
- Current Floorplan Info: Displays images, title, pricing, attributes, buttons, and description
- Units Table/List: Shows available units (only if units exist)
- Property Fees: Embedded fee information from the associated property
- Tour Embed: Virtual tour iframe if available
- Similar Floorplans: Related floor plans from the same property with matching bedroom count
Overriding the Entire Template
Method 1: Theme Template Override
Create a file named single-floorplans.php in your theme directory:
your-theme/
├── single-floorplans.php
Method 2: Template Filter
The plugin uses the single_template filter with high priority (99) to load templates. You can override this in your theme’s functions.php:
<?php
function my_custom_floorplan_template( $template ) {
if ( is_singular( 'floorplans' ) ) {
return get_template_directory() . '/custom-single-floorplan.php';
}
return $template;
}
add_filter( 'single_template', 'my_custom_floorplan_template', 100 );
Method 3: Overriding individual components
The template uses WordPress actions and filters for component customization. You can remove default hooks and add your own.
Building your own template
Regardless of how you build your own single-floorplans template, you’ll likely want to use some of Rent Fetch’s helpful functions for retrieving relevant information about floor plans and associated units (because you probably don’t want to write your own custom queries to retrieve all of this information by hand). Here’s a list of the main functions and hooks used in our default template:
Data Retrieval Functions
rentfetch_get_floorplan_specials(): Returns any special offers or promotions for the floor planrentfetch_get_floorplan_title(): Returns the floor plan title (with filters applied)rentfetch_get_floorplan_bedrooms(): Returns formatted bedroom informationrentfetch_get_floorplan_bathrooms(): Returns formatted bathroom informationrentfetch_get_floorplan_square_feet(): Returns formatted square footagerentfetch_get_floorplan_available_units(): Returns the number of available unitsrentfetch_get_floorplan_links(): Returns availability and application linksrentfetch_get_floorplan_pricing(): Returns formatted pricing informationrentfetch_get_floorplan_units_count_from_cpt(): Returns total unit count from the custom post typerentfetch_get_floorplan_description(): Returns the floor plan description
Property-Related Functions
rentfetch_get_property_fee_embed_from_floorplan_id( $floorplan_id ): Returns embedded fee information from the associated propertyrentfetch_get_floorplan_tour_embed(): Returns the tour embed code/iframerentfetch_floorplan_tour_embed(): Outputs the tour embed (echoes the iframe)
Similar Floor Plans Functions
rentfetch_get_similar_floorplans(): Returns an array of similar floor plans (same property, same bedroom count)rentfetch_similar_floorplans(): Outputs the similar floor plans grid
Action Hooks (with Default Functions)
rentfetch_do_floorplan_images:- Default:
rentfetch_floorplan_images()– displays image gallery/slider
- Default:
rentfetch_do_floorplan_buttons:rentfetch_floorplan_default_availability_button()– availability/lease buttonrentfetch_floorplan_default_unavailability_button()– unavailability buttonrentfetch_floorplan_default_contact_button()– contact buttonrentfetch_floorplan_default_tour_button()– tour scheduling button
rentfetch_floorplan_do_unit_table:rentfetch_floorplan_unit_table()– desktop table view of unitsrentfetch_floorplan_unit_list()– mobile accordion view of units
Filter Hooks for Headlines
rentfetch_single_floorplan_units_headline: Filters the “Units” section headlinerentfetch_single_floorplan_property_fees_headline: Filters the “Property Fees” section headlinerentfetch_single_floorplan_tour_headline: Filters the “Take a look around” section headlinerentfetch_single_floorplan_more_floorplans_headline: Filters the “Similar Floor Plans” section headline