Guest User

Untitled

a guest
Nov 20th, 2017
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. $locations = get_the_terms( get_post(), 'locations' );
  2.  
  3. $locations_grouped = [];
  4.  
  5. foreach( $locations as $location ) {
  6.  
  7. $location_type = get_term_meta( $location->term_id, 'location-type', true );
  8.  
  9. if ( ! $location_type) {
  10. $type = 'other';
  11. }
  12.  
  13. if ( ! array_key_exists( $location_type, $locations_grouped ) ) {
  14. $locations_grouped[$location_type] = [];
  15. }
  16.  
  17. $locations_grouped[$location_type] = $location;
  18.  
  19. }
Add Comment
Please, Sign In to add comment