Closed mervb closed 1 year ago
Currently we have helper functions to get the Label eg Current, Sold Leased from the saved value of current sold leased
/** * Test function to display the category * * @return void */ function some_function() { global $property; $category = $property->get_property_meta( 'property_category' ); $label = epl_listing_meta_property_category_value( $category ); echo '<br>' . $label; } add_action( 'epl_property_price', 'some_function' );
If would be handy to have a helper function that we could pass the meta key and get the label
like get_property_meta_label( 'property_category' )
example
function epl_maybe_get_meta_label( $meta_key ) { $value = get_property_meta( $meta_key ); $function = 'epl_get_'.$meta_key.'_opts'; if( function_exists( ) ) { $labels = $function(); $value = isset( $labels[$value] ) ? $labels[$value] : $value; } return $value; }
as we already have a public function
get_property_meta lets call this get_property_meta_label
added epl_get_property_meta_label function in 3.5
Currently we have helper functions to get the Label eg Current, Sold Leased from the saved value of current sold leased
If would be handy to have a helper function that we could pass the meta key and get the label
like get_property_meta_label( 'property_category' )
example