Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $locations = get_the_terms( get_post(), 'locations' );
- $locations_grouped = [];
- foreach( $locations as $location ) {
- $location_type = get_term_meta( $location->term_id, 'location-type', true );
- if ( ! $location_type) {
- $type = 'other';
- }
- if ( ! array_key_exists( $location_type, $locations_grouped ) ) {
- $locations_grouped[$location_type] = [];
- }
- $locations_grouped[$location_type] = $location;
- }
Add Comment
Please, Sign In to add comment