Select Page

Search Knowledge Base by Keyword

Build Custom Templates with RentPress Data

You are here:
Table of Contents

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
  • email
  • latitude
  • longitude
  • amenities
  • communityAmenities
  • units
  • ilsTrackingCodes
  • timezone
  • officeHours
  • rent
  • beds
  • sqftg
  • image
  • generalImages
  • staffMembers
  • specialsMessage

Floor Plans

  • name
  • beds
  • baths
  • sqft
  • rent
  • availableUnitCount
  • availabilityUrl
  • pdf
  • 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/Template_Tags/get_posts
https://codex.wordpress.org/Post_Meta_Data_Section