epl_get_property_com_authority_label(): the label for a commercial authority

Description #

Turns a commercial listing's saved authority into the label people read, for example eoi into "EOI". The authority is the Commercial Authority field on commercial and commercial land listings (meta key property_com_authority).

Use it in a template or snippet instead of printing the saved value.


Usage #

epl_get_property_com_authority_label( $key );

Parameters #

$key (string)
The saved value: Forsale, auction, eoi, offers, Sale or tender, or one you added.

Returns (string)
The label, for example "For Sale", "Auction", "EOI", "Offers", "Sale" or "Tender". An empty string when the value isn't one of the options (or isn't a string).


Examples #

$authority = epl_get_property_com_authority_label( get_property_meta( 'property_com_authority' ) );

if ( '' !== $authority ) {
	echo '<span class="my-authority">' . esc_html( $authority ) . '</span>';
}

The labels come from epl_get_property_com_authority_opts(), so options added or renamed with the epl_opts_property_com_authority_filter filter work here too:

function my_com_authority_opts( $opts ) {
	$opts['eoi'] = 'Expressions of Interest';
	return $opts;
}
add_filter( 'epl_opts_property_com_authority_filter', 'my_com_authority_opts' );


Source #

lib/includes/functions.php, in epl_get_property_com_authority_label(). Since 3.6.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.