Single-properties.php
Rent Fetch provides a flexible templating system for single property pages that allows extensive customization while maintaining default functionality.
Template Hierarchy
Rent Fetch follows WordPress template hierarchy with custom overrides:
- Theme Override: single-properties.php in your theme root
- Plugin Default: single-properties.php
The plugin automatically detects and loads the appropriate template.
Main Template Structure
The default single properties template is minimal:
<?php
get_header();
echo '<div class="single-properties-wrap">';
do_action( 'rentfetch_do_single_properties_parts' );
echo '</div>';
get_footer();
Template Parts
The template is composed of modular parts that are added via the rentfetch_do_single_properties_parts action hook. Each part can be customized or removed independently.
Default Parts (in order)
- Images (
rentfetch_single_properties_parts_images)- Displays property image gallery
- Location:
single-properties-sectionwith IDimages - Admin option:
property_images
- Subnav (
rentfetch_single_properties_parts_subnav)- Navigation menu for page sections
- Location:
single-properties-section no-paddingwith IDsubnav - Admin option:
section_navigation
- Details (
rentfetch_single_properties_parts_details)- Property title, address, and basic information
- Location:
single-properties-sectionwith IDdetails - Admin option:
property_details
- Floorplans (
rentfetch_single_properties_parts_floorplans)- Floor plan listings with pricing and availability
- Location:
single-properties-sectionwith IDfloorplans - Admin option:
floorplans_display
- Fees Embed (
rentfetch_single_properties_parts_fees_embed)- Property fees and charges display
- Location:
single-properties-sectionwith IDfees - Admin option:
fees_embed_display
- Amenities (
rentfetch_single_properties_parts_amenities)- Property amenities list
- Location:
single-properties-sectionwith IDamenities - Admin option:
amenities_display
- More Information (
rentfetch_single_properties_parts_more_information)- Additional property content from the editor
- Location:
single-properties-sectionwith IDmore-information - Always enabled (displays only if content exists)
- Map (
rentfetch_single_properties_parts_map)- Google Maps display
- Location:
single-properties-section no-padding full-widthwith IDgooglemaps - Admin option:
property_map
- More Properties (
rentfetch_single_properties_parts_more_properties)- Related properties section
- Location:
single-properties-sectionwith IDmore-properties - Admin option:
nearby_properties
Customization Methods
Method 1: Override Main Template
Create single-properties.php in your theme:
<?php
get_header();
// Custom wrapper with your classes/structure
echo '<div class="my-custom-property-wrapper">';
// Include only specific parts
do_action( 'rentfetch_single_properties_parts_images' );
do_action( 'rentfetch_single_properties_parts_details' );
// Add custom content
echo '<div class="my-custom-section">';
// Your custom content here
echo '</div>';
do_action( 'rentfetch_single_properties_parts_floorplans' );
echo '</div>';
get_footer();
Method 2: Modify Individual Parts
Each part function can be filtered. For example, to modify the details section:
<?php
function my_custom_property_details() {
// Custom details markup
echo '<div id="details" class="single-properties-section my-custom-details">';
// Your custom details content
echo '</div>';
}
remove_action( 'rentfetch_do_single_properties_parts', 'rentfetch_single_properties_parts_details' );
add_action( 'rentfetch_do_single_properties_parts', 'my_custom_property_details' );
Method 3: Remove/Add Parts
<?php
// Remove unwanted sections
remove_action( 'rentfetch_do_single_properties_parts', 'rentfetch_single_properties_parts_more_properties' );
remove_action( 'rentfetch_do_single_properties_parts', 'rentfetch_single_properties_parts_fees_embed' );
// Add custom sections
function my_custom_section() {
echo '<div class="single-properties-section">';
echo '<h2>My Custom Section</h2>';
// Custom content
echo '</div>';
}
add_action( 'rentfetch_do_single_properties_parts', 'my_custom_section', 15 ); // Position after details
Method 4: Reorder Parts
Since parts are added with default priority 10, you can reorder by removing and re-adding with different priorities:
<?php
// Move amenities before floorplans
remove_action( 'rentfetch_do_single_properties_parts', 'rentfetch_single_properties_parts_amenities' );
add_action( 'rentfetch_do_single_properties_parts', 'rentfetch_single_properties_parts_amenities', 5 ); // Lower priority = earlier
Method 5: Filter Content Within Parts
Many parts have filters for specific content. For example:
<?php
// Modify property title display
add_filter( 'rentfetch_single_properties_title', function( $title ) {
return '<h1 class="my-custom-title">' . $title . '</h1>';
} );
// Modify amenities display
add_filter( 'rentfetch_single_properties_amenities_output', function( $output ) {
return '<div class="my-amenities">' . $output . '</div>';
} );
Admin Options
Most sections can be enabled/disabled via Rent Fetch > Settings > Properties > Single Property Components:
- Property images
- Section navigation
- Property details
- Floorplan display
- Property fees display
- Amenities display
- Property map
- Nearby properties
Note: “More Information” cannot be disabled via admin options – it displays automatically when content exists.
CSS Classes and Structure
Each section uses consistent CSS classes:
- Container:
.single-properties-wrap - Sections:
.single-properties-section - Modifiers:
.no-padding– Removes default padding.full-width– Makes section full width
Available Hooks
Main Structure Hooks
rentfetch_do_single_properties_parts– Main content assembly
Section-Specific Hooks
rentfetch_single_properties_parts_imagesrentfetch_single_properties_parts_subnavrentfetch_single_properties_parts_detailsrentfetch_single_properties_parts_floorplansrentfetch_single_properties_parts_fees_embedrentfetch_single_properties_parts_amenitiesrentfetch_single_properties_parts_more_informationrentfetch_single_properties_parts_maprentfetch_single_properties_parts_more_properties
Content Filters
rentfetch_single_properties_titlerentfetch_single_properties_addressrentfetch_single_properties_amenities_outputrentfetch_single_properties_floorplans_output
Best Practices
- Preserve IDs: Keep section IDs for navigation and styling
- Maintain Structure: Use the
.single-properties-sectionclass for consistency - Test Responsiveness: Ensure custom layouts work on mobile devices
- Use Filters First: Prefer filters over complete overrides when possible
- Document Changes: Comment your customizations for future maintenance
Example: Complete Custom Template
<?php
/**
* Custom Single Properties Template
* Place in your theme as single-properties.php
*/
get_header();
$property_id = get_the_ID();
$property_title = get_the_title();
?>
<div class="my-property-page">
<header class="property-hero">
<?php
// Custom hero section
if ( has_post_thumbnail() ) {
the_post_thumbnail( 'large' );
}
?>
<div class="hero-content">
<h1><?php echo esc_html( $property_title ); ?></h1>
<?php echo esc_html( get_post_meta( $property_id, 'address', true ) ); ?>
</div>
</header>
<nav class="property-nav">
<?php do_action( 'rentfetch_single_properties_parts_subnav' ); ?>
</nav>
<main class="property-content">
<div class="property-details">
<?php do_action( 'rentfetch_single_properties_parts_details' ); ?>
<?php do_action( 'rentfetch_single_properties_parts_amenities' ); ?>
</div>
<div class="property-floorplans">
<?php do_action( 'rentfetch_single_properties_parts_floorplans' ); ?>
</div>
<div class="property-fees">
<?php do_action( 'rentfetch_single_properties_parts_fees_embed' ); ?>
</div>
</main>
<aside class="property-sidebar">
<?php do_action( 'rentfetch_single_properties_parts_map' ); ?>
<?php do_action( 'rentfetch_single_properties_parts_more_properties' ); ?>
</aside>
</div>
<?php get_footer(); ?>
This approach gives you complete control over the layout while still leveraging Rent Fetch’s functionality for individual sections.