Search Knowledge Base by Keyword
Build Custom Templates with RentPress Data
Table of Contents
Please note:
This document is for RentPress version 6 and earlier. If you are running version 7 or above, please reference RentPress Data Layer and Data Structure.
Step 1 – Create Array of Posts
Below is an example of how RentPress data can be included into custom floor plan templates.
<?php $floorplans_query_args = array( 'post_type' => 'floorplans', 'post_status' => 'publish', 'nopaging' => true ); $floorplans=get_posts($floorplans_query_args); ?>
Step 2 – Loop Through Posts and Set Meta Data to Variables
<?php foreach ($floorplans as $floorplan) { $Floorplan = $rentPress_Service['floorplans_meta']->setPostID($floorplan- >ID); $floorPlanData = get_post_meta($floorplan->ID); $fpName = $floorPlanData['fpName'][0]; $sqft = $floorPlanData['fpMinSQFT'][0]; $bedCount = $floorPlanData['fpBeds'][0]; $bathCount = $floorPlanData['fpBaths'][0]; $fpMinRent = $floorPlanData['fpMinRent'][0]; $fpAvailUnitCount = $floorPlanData['fpAvailUnitCount'][0]; $fpUnitsCaptured = $floorPlanData['fpUnitsCaptured'][0]; $fpImg = esc_url($Floorplan->image()); $fpImg = explode(',', $fpImg); if ( is_array($fpImg) && count($fpImg) >= 1 ) { $fpImg = $fpImg[0]; } } ?>
Step 3 – Display Property Data
<img src="<?php echo $fpImg; ?>"> <div>Bedrooms: <?php echo $fpBeds; ?></div>
RentPress Custom Post Types and Meta Data
Properties
- phone
- availabilityUrl
- address
- slug
- description
- city
- state
- zip
- website
- latitude
- longitude
- amenities
- communityAmenities
- units
- ilsTrackingCodes
- timezone
- officeHours
- rent
- beds
- sqftg
- image
- generalImages
- staffMembers
- specialsMessage
Floor Plans
- name
- beds
- baths
- sqft
- rent
- availableUnitCount
- availabilityUrl
- units
- image
Units
- name
- application
- tourLink
- quoteLink
- buildingLevel
- hasSpecial
- special
- videos
- images
- amenities
- beds
- baths
- availabilityLink
- sqft
- unitID
- parentPropertyID
- floorPlanID
- availableOn
- rent
Recommended Resources
https://codex.wordpress.org/Post_Meta_Data_Section