Support Forum
Support › General › ✅How to use conditional logic and then display custom meta on a page. › Reply To: How to use conditional logic and then display custom meta on a page.
Hi,
Are "Tampa" and "St Pete" terms of the "office location" taxonomy?
If so, you have some ways to store the actual address of each location (each term):
After that, you'll be able to enter address for each location ("term") when you edit them.
To show the office address, you can use this snippet:
$locations = wp_get_object_terms( get_the_ID(), 'office_location_taxonomy' );
if ( ! empty( $locations ) && ! is_wp_error( $locations ) ) {
$location = reset( $locations );
echo 'Address: ', $location->description; // If you use term description.
echo 'Address: ', rwmb_meta( 'address_field_id', array( 'object_type' => 'term' ), $location->term_id ); // If you use MB Term Meta
}