get_label_from_meta_key

Description

Returns the meta key as a formatted string. 

Note: This function requires you to define the global $property value in order to use it.

Usage

In order to use this function in custom templates you need to define the global $property variable at least once.

<?php 
global $property;
$property->get_property_meta( $meta_key , $allowzero ); ?>

Parameters

$meta_key
 
(string) (required) The meta key value that will be returned.

$allowzero
(true/false) (optional default is true) If your saved value is a 0 the function will return 0. Set to false if you do not want to display a 0 result.

Examples

Default Usage

Use the following example to get the number of bedrooms.

<?php 
global $property;
$bedrooms = $property->get_property_meta( 'property_bedrooms' , false ); ?>
Retrieving multiple results in a single function

The following example will output several values into a function you can output into a template hook.

<?php 
function my_output_several_custom_values() {
	global $property;
	$meta_keys = array(
		'property_bedrooms',
		'property_bathrooms',
		'property_shed'
	);
	foreach( $meta_keys as $meta_key ){
		echo $meta_key . ' => ' . $property->get_property_meta( $meta_key , false ) . '</br>';	
	}
}
property_bedrooms => 4
property_bathrooms => 2
property_shed => 1