Output a list of similar properties to another property anywhere on the website using the shortcode:
By default this will output 2 properties in a random order and uses the content-property-featured.php template. A ‘similar’ property is classed as one that has a price 10% either side of the property in questions’ price, has the same number of bedrooms and is of the same department.
Usage in Templates
If wanting to show similar properties in one of the single property template:
echo do_shortcode("[similar_properties property_id=" . $property->id . "]");
Note: Requires the $property object to be declared as a global variable. Alternatively the below will do the same thing:
echo do_shortcode("[similar_properties property_id=" . get_the_ID() . "]");
Description: Determines the number of properties returned.
Example: [similar_properties per_page="6"]
Description: The ID of the property in question
Example: [similar_properties property_id="413"]
Description:The upper and lower price percentages when determining what properties are classed as ‘similar’. For example, if the property in question was £100,000 and this attribute was 10%, properties returned would be between £90,000 and £110,000. Pass as an empty string to not filter by price.
Example: [similar_properties price_percentage_bounds="15"]
Description:The upper and lower bedrooms number when determining what properties are classed as ‘similar’. If 0 only return properties with the same number of bedrooms. If a property had 2 bedrooms, passing this attribute as ‘1’ would include properties with 1 to 3 bedrooms. Pass as an empty string to not filter by bedrooms
Example: [similar_properties bedroom_bounds="1"]
Description: Allows you to specify only properties with the same address field should be returned.
Possible Values: address_two, address_three, address_four, location
Example: [similar_properties matching_address_field="address_three"]