Add the property name to each floorplan

For small multi-property websites, you may want to show a combined view of all of the floorplans, but you’d still like your users to be able to see at a glance which floorplans belong to which property. Here’s a snippet that can help:

// How to add the property title to each floorplan
function rf_add_property_title_to_floorplan_title( $title ) {
		
	$property_id = get_post_meta( get_the_ID(), 'property_id', true );
			
	// do a query for properties with this property_id
	$args = array(
		'post_type' => 'properties',
		'posts_per_page' => 1,
		'meta_query' => array(
			array(
				'key' => 'property_id',
				'value' => $property_id,
			)
		)
	);
	
	$propertylist = get_posts( $args );
	$property = $propertylist[0];
		
	if ( $property->post_title )
		$title = sprintf( '%s - %s', $property->post_title, $title );
		
	return $title;
}
add_filter( 'rentfetch_filter_floorplan_title', 'rf_add_property_title_to_floorplan_title', 10, 1 );
My Cart
0
Subtotal
Total Installment Payments
Bundle Discount