Properties search
The [rentfetch_propertysearch] shortcode (typical usage documentation) displays a property search interface with filters, results list, and interactive map. Unlike the static [rentfetch_properties] grid (usage and customization documentation), this shortcode has two separate templates for displaying each property: one for the results list and one for the map popups.
Default Hook Structure
The shortcode renders results using two containers:
.property-in-list– callsdo_action( 'rentfetch_do_properties_each_list' ).property-in-map– callsdo_action( 'rentfetch_do_properties_each_map' )
Complete Layout Replacement for List View
To replace the entire property layout in the results list:
<?php
remove_action( 'rentfetch_do_properties_each_list', 'rentfetch_properties_each_list' );
function hello_world_list() {
echo '<div>Hello World List</div>';
}
add_action( 'rentfetch_do_properties_each_list', 'hello_world_list' );
Complete Layout Replacement for Map View
To replace the entire property layout in the map popups:
<?php
remove_action( 'rentfetch_do_properties_each_map', 'rentfetch_properties_each_map' );
function hello_world_map() {
echo '<div>Hello World Map</div>';
}
add_action( 'rentfetch_do_properties_each_map', 'hello_world_map' );
Available Data Functions
Use these functions to retrieve property data (there are many others available in functions-properties.php)
Basic Information:
rentfetch_get_property_title()– Property titlerentfetch_get_property_location()– Full address/locationrentfetch_get_property_city_state()– City, State format
Property Details:
rentfetch_get_property_bedrooms()– Bedroom rangerentfetch_get_property_bathrooms()– Bathroom rangerentfetch_get_property_square_feet()– Square footagerentfetch_get_property_pricing()– Rent informationrentfetch_get_property_availability()– Available units count
Additional Features:
rentfetch_get_property_specials_from_meta()– Special offersrentfetch_get_property_tour()– Tour availability indicatorrentfetch_get_property_permalink()– Property page URLrentfetch_get_link_target( $url )– Link target attribute
CSS Classes and Structure
- List items are wrapped in
.property-in-list - Map items are wrapped in
.property-in-map(hidden by default) - Both inherit classes from
get_post_class()filtered throughrentfetch_filter_properties_post_classes - Map items include
data-latitude,data-longitude,data-id, anddata-marker-idattributes
Best Practices
- Keep Map Layouts Simple: Map popups should be concise due to space constraints
- Maintain Data Attributes: Preserve latitude/longitude data for map functionality
- Test Both Views: Ensure layouts work in both list and map contexts
- Use Semantic HTML: Maintain proper heading hierarchy and accessibility
- Handle Missing Data: Check for empty values before outputting content
This dual-template system allows for optimized layouts for both the detailed list view and the compact map popup view.